|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
owner Permission changed automatically
HI all, We had created new user using the command useradd -d /home/selva -s /usr/local/bin/bash selva . But it didnt created the home directory on /home. So i manually created, copied skel files manually and changed the owner from root to selva. At the same time i observed that so many files copied from /etc to /home directory on the same time and some files owners are showing as selva. Code:
Output of /etc/default/useradd #default useradd options HOMEDIR /home GROUPID 20 INACT -1 EXPIRE CHOWN_HOMEDIR no CREAT_HOMEDIR no START_PROGRAM /sbin/sh SKEL_DIR /etc/skel ALLOW_DUP_UIDS no COMMENT Code:
Output of selva id: uid=109(selva) gid=20(users) Code:
Group output of Users: users::20:root Fully I am confused...I have attached files which was created automatically in /home and see the owners and my history file. Last edited by methyl; 02-07-2012 at 09:10 AM.. Reason: please use code tags |
| Sponsored Links | |
|
|
|
#2
|
|||
|
|||
|
u missed -m argument
# useradd -d /home/selva -s /usr/local/bin/bash -m selva --Shirish Shukla |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
For that only I did manually...but why should unwanted files copied from /etc/ to /home. and also owners of all users home directory changed to selva as owner. and some /usr/, /var/, /opt files also got changed...What will be the reason behind...?
|
|
#4
|
|||
|
|||
|
Quote:
What did you actually type? (If you have a .sh_history file , have a look at it with the "strings" command). Ps. I can't read your ".jpg" attachments. Can you post in text? Last edited by methyl; 02-07-2012 at 09:22 AM.. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
HI Shirish Shukla,
By missing -m, how the files will copy and file permission got changed. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
When u missed -m option then -d /homepath get updated in /etc/passwd file ... but dir /homepath will not get created that had happend at your case ... and you had created that dir after and copied that files from skel dir right ...
Better recreate the user ... with right parameters ... --Shirish Shukla |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Finally managed to read the .jpg examples. The issue is with these commands. I've posted them as comments because we don't want people executing them. Code:
# bad line 1 # vi /etc/passwd # bad line 2 # cp -rf /etc/skel/.* /home/selva/ # bad line 3 # chmod -R selva:users /home/selva/.* # bad line 4 # chown -R selva:users /home/selva/.* 1) NEVER use "vi" on /etc/passwd. If you are expert, use the "vipw" command, but in your case you probably just needed "view". 2) This command is terrifying. Try this to see what I mean: ls /etc/skel/.* Compared with: ls /etc/skel/.??* 3) This command is a syntax error and didn't do anything. 4) This command is terrifying. Try this to see what I mean: ls /home/selva/.* Compared with: ls /home/selva/.??* The problem is your use of ".* " when you expected it to match filenames starting with a ". " . It actually expanded the the parent directory ". " in both occasions. Your problem was made so much worse by using recursive (-r/-R) and overwrite (-f) options to commands when there was no point in that context. It should be possible to use the "ls" commands I posted above to determine which files were copied or changed in error. However because you used the "-f" switch to "cp" be careful about detecting files which were overwritten (if any). It's such a mess that it may be quicker to go back to backup, but it depends on how many files you had in /home and whether all permissions are easy to fix. The change of permissions of some files in /usr /var /opt will be because many of the original files in /etc are LINKS and having copied the lot to /home/selva your commands then issue a recursive "chown" on the copies. Scary. I'm surprised that this system is still running, but don't reboot the system without repairing all the permissions of system files. QED. Last edited by methyl; 02-08-2012 at 12:02 PM.. Reason: typos (lots) |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| /usr/bin has been changed with 777 permission | bullz26 | Solaris | 5 | 09-03-2009 07:06 AM |
| automatically change owner and group | borderblaster | Shell Programming and Scripting | 1 | 04-24-2009 07:11 AM |
| how I know owner of file and its permission through c program | amitpansuria | Programming | 4 | 10-05-2008 04:19 AM |
| How to changed Permission on Tape | real-chess | Linux | 6 | 09-09-2008 08:42 AM |
| permission, owner and group | pascalbout | Shell Programming and Scripting | 2 | 01-14-2006 10:47 AM |
|
|