- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Directory permissions and important files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 08:25 PM
тАО07-22-2002 08:25 PM
Directory permissions and important files
I had Billy (well thats what I will call them)
do a mv * from the / directory on one of our servers to a /u01/app/billy directory
What permissions would you recommend that I put in place on the directories
/stand
/dev
/etc
/sbin
/usr
/var
/opt
.rhosts
Is there a guideline? This was a standard Hpux 11.0 install and the mv * moved quite a lot of files.
Or do I just cut Billy's fingers off one by one?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 08:28 PM
тАО07-22-2002 08:28 PM
Re: Directory permissions and important files
dr-xr-xr-x 22 bin bin 5120 Jul 17 12:21 dev
drwxr-xr-x 4 root root 96 Dec 27 2000 download
dr-xr-xr-x 27 bin bin 6144 Jul 23 00:14 etc
drwxr-xr-x 2 root sys 96 Sep 20 2001 goforit
drwxr-xr-x 44 root root 2048 Jun 17 10:30 home
drwxr-xr-x 2 root sys 96 Oct 30 2001 hot
drwx------ 3 root opcgrp 96 Jan 17 2001 ito_upgrade
drwxr-xr-x 2 root root 96 Oct 26 2000 lost+found
drwxr-xr-x 3 root sys 96 Mar 20 2001 mark
-rw-r--r-- 1 root sys 1932 Apr 2 2001 mecdrrp
drwxrwxr-x 2 root sys 96 Aug 27 2001 mnt
dr-xr-xr-x 1 root root 512 Jun 6 12:14 net
dr-xr-xr-x 13 root sys 1024 Dec 26 2000 nsr
drwxrwxrwx 10 root root 2048 Jul 16 2001 omnidata
drwxr-xr-x 39 bin bin 1024 Oct 31 2001 opt
drwxr-xr-x 2 root sys 1024 Mar 16 2001 ranhome
drwxr-xr-x 2 root root 8192 Apr 24 17:19 rantest
drwxr-xr-x 3 root sys 1024 Apr 10 14:13 root
dr-xr-xr-x 12 bin bin 3072 May 17 01:47 sbin
drwxr-xr-x 2 root sys 96 Aug 24 2001 scripts
dr-xr-xr-x 7 bin bin 1024 May 17 04:16 stand
dr-xr-x--x 3 root sys 96 Mar 19 2001 tcb
dr-xr-x--x 3 root sys 96 Mar 19 2001 tcb.old
drwxr-xr-x 3 root sys 196608 Jul 17 21:33 test
drwxr-xr-x 11 lp bin 8192 May 17 11:56 test1
drwxr-xr-x 7 root root 4096 May 17 13:05 test2
drwxrwxrwx 12 bin bin 19456 Jul 23 00:22 tmp
dr-xr-xr-x 2 root root 96 Oct 27 2000 tmp_mnt
drwxr-xr-x 5 oracle dba 96 Jan 3 2001 u01
dr-xr-xr-x 28 bin bin 1024 Jun 7 00:31 usr
dr-xr-xr-x 21 bin bin 1024 Oct 31 2001 var
drwxrwxr-x 2 root sys 96 Jun 6 23:50 vlogix
-rw-r--r-- 1 root sys 519 Jul 5 17:19 .rhosts
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 08:30 PM
тАО07-22-2002 08:30 PM
Re: Directory permissions and important files
What were you trying do, when doing a 'mv *' from /?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 08:42 PM
тАО07-22-2002 08:42 PM
Re: Directory permissions and important files
The person accidentally did a mv as user "billy" from the root directory (they were meant to be in a different directory)and I want to prevent them from being able to do such a move again. I was able to mv the files back into their appropiate directories but I dont want to be in the same situation again.
Cheers
Darren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 08:47 PM
тАО07-22-2002 08:47 PM
Re: Directory permissions and important files
To prevent this in the future I'd do a couple of things.
1) Discourage the use of mv. Do a cp, and that way if you cp the wrong thing, the original is still there.
2) Customize your prompt, the PS1 variable, so that your current working directory is displayed in it. That way you can double-check at a glance before you do a cp or mv.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 08:54 PM
тАО07-22-2002 08:54 PM
Re: Directory permissions and important files
I've actually set the variable so it is displayed but this person is a 2 cans short of a six pack.
Plus Ive told them about 5 times
Any suggestions so I can avoid the files being actually moved. They received a lot of permission denied messages but still had files moved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 09:08 PM
тАО07-22-2002 09:08 PM
Re: Directory permissions and important files
If users *have* to have shell access, create them with a restricted shell.
If they have to do something else, utilise either 'sudo' from here: http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.2b1/ or set up a restricted 'sam' (sam -r)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2002 09:11 PM
тАО07-22-2002 09:11 PM
Re: Directory permissions and important files
Check out the CIS (Centre for Internet Security) security benchmark for HP-UX at:
http://www.cisecurity.org/bench_HPUX.html
It provides security guidelines (including permission settings) for HP-UX 11.00 in addition to HP-UX 10.20 and HP-UX 11.11.
Pretty comprehensive. Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2002 03:08 AM
тАО07-23-2002 03:08 AM
Re: Directory permissions and important files
Short of cutting off "Billy"'s fingers, you could always try mittens - effective, yet much more humane. Get the ones with the string that runs up one sleeve, across the back and down the other sleeve. Then put your foot in the middle of his back and yank all the slack out of the string and tie a knot in it so "Billy" can't get the mittens off. That'll slow him down.
Good Luck,
Pete
P.S. Public embarassment, done in a humorous sort of way (you don't want to get yourself in trouble) sometimes prods this sort of "challenged induhvidual". Try telling him about the mittens idea in the middle of the lunch room.
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2002 03:29 AM
тАО07-23-2002 03:29 AM
Re: Directory permissions and important files
To put the mv command under control then:-
Change its permissions from 555 to 500
Root only.
Just an Idea
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2002 03:49 AM
тАО07-23-2002 03:49 AM
Re: Directory permissions and important files
777 is a big red flag that untrained sysadmins sometimes use when things don't work right. 777 on a directory means that nothing in the directory at ANY level can be trusted. And unfortunately, your umask may never have been setup (an absolute requirement after an install). That means you probably have dozens, perhaps hundreds of files and directories that have wrong permissions, all created by root since the install occurred.
If this system is in production and downtime is a problem, Billy never gets the root password, period. If Billy is your assistant, then pick specific, low-risk tasks like adding users or cancelling print jobs and use either restricted sam (see the sam man page) or install sudo and setup Billy with a few commands. sudo can even restrict the parameters that are allowed for the commands (like mount and umount).
Since you mentioned .rhosts in conjunction with the / (root) directory, it saounds like you have not moved root's $HOME to a safe location. Root's $HOME should NEVER be in the / directory and the above situation is one example of the problem. One scenario that Billy may have used is to move dotfiles using the very dangerous command:
mv .* /someplace
The reason this is dangerous is that .* matches not only dotfiles like .rhosts, it also matches .. and that is the parent of the current working directory. So if Billy was root (never allow DBAs to have root passwords) and typedsomething like:
cd /opt/le
mv * .* /u01/app/billy
then not only would all the files in the current directory be moved, but /opt would be moved. Another guess is that some strange application was installed and it filled the root filesystem because it refused to ask the installer where it should be located (should be /opt). So Billy dutifully read the Unix for Newbies book and typed something like this:
cd /StrangeAppLocation
mv * .* /u01/app/billy
and away all the directories go...A very good technique is to put the word echo or print in front of dangerous commands like mv and rm to see what they will do. Example:
echo mv * .* /u01/app/billy
Now you'll see how the shell expanded (globbing) the filenames given to mv.
As soon as possible, change the root password, perform a cold install and reinstall all your apps. Set umask 022 in /etc/profile and /etc/csh.profile, create /root and move all ordinary files from / to /root (move the dotfiles using: mv /.[!.]* /root which moves all files except those with ..
And you may want to make root's versions of the dangerous commands always ask permission by adding this to .profile:
alias mv='/usr/bin/mv -i' # ask before overlaying
alias cp='/usr/bin/cp -i' # ask before overlaying
alias rm='/usr/bin/rm -i' # ask before removing
Finally, once your system is stable, download Ignite/UX from HP's website and run make_tape_recovery! This wil avoid another cold install in the future.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2002 12:56 AM
тАО08-02-2002 12:56 AM
Re: Directory permissions and important files
If umask was never set, you can secure the files owned by root by typing:
find /* /.* -user root -exec chmod go-w {} \;
This will remove the write bit from group and other on all the files on your system that is owned by root. I haven't done this myself on any system and I suspect this will bugger up a lot of root-owned files that needs to be world-wide writeable. Consider this option as the last one before reinstalling your os.
To "secure" your root folder only you can do:
find /* /.* -prune -user root -exec chmod go-w {} \;
Basically the same thing as the one above, but only on the top level. Safer.