owner Permission changed automatically


 
Thread Tools Search this Thread
Operating Systems HP-UX owner Permission changed automatically
# 1  
Old 02-07-2012
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.
owner Permission changed automatically-issue1jpg
owner Permission changed automatically-issue2jpg

Last edited by methyl; 02-07-2012 at 10:10 AM.. Reason: please use code tags
# 2  
Old 02-07-2012
u missed -m argument

# useradd -d /home/selva -s /usr/local/bin/bash -m selva

--Shirish Shukla
# 3  
Old 02-07-2012
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  
Old 02-07-2012
Quote:
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.
We assume that you were logged in as "root" and typed one of more commands incorrectly which caused unexpected change to the system.

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 10:22 AM..
# 5  
Old 02-08-2012
HI Shirish Shukla,

By missing -m, how the files will copy and file permission got changed.
# 6  
Old 02-08-2012
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
# 7  
Old 02-08-2012
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 01:02 PM.. Reason: typos (lots)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

/dev/dm-? owner changed.

After reboot of redhat 6 server , the owner of /dev/dm-? changed, causing the oracle disk group to show insufficient no of disk. how to identify which dm-? owner is changed.? (2 Replies)
Discussion started by: shivdeep77
2 Replies

2. Linux

Mount point permission was changed

Hello everybody, I have many mount points on my virtual Redhat server, two of them lost their (write) permission, so they became read-only filesystems. I fixed this problem. But I want to know why it happened? What is the reason behind that to avoid it again? Where can I find related logs?... (2 Replies)
Discussion started by: Mohannad
2 Replies

3. AIX

Syslogs permission not getting changed - aix 6.1

Friends, I've tried to modify the syslogs permission by using the perm option in the syslog configuration in AIX 6.1 TL 05. But its not getting applied after the configuration. Have restarted the syslog service also. Need your help!:wall: The below are the conf details and os versions >... (1 Reply)
Discussion started by: novaothers
1 Replies

4. Solaris

setfacl don't change permission on group owner

I try to use setfacl command to change the permission of the group primary it does not accept the command , it really accept but don't change the permission on the group. the point here I read that if I use chmod command on group primary the mask changed, but if I use setfacl mask should not... (0 Replies)
Discussion started by: hard_revenge
0 Replies

5. Shell Programming and Scripting

search files with owner having execute permission

Hi All, I have to search for all files in the current directory where the owner having execute operation. I can find the files with specific permission such as 666 find . -type f -perm 666 But how to find files with only execute permission to user. tried with : find . -type f... (3 Replies)
Discussion started by: gotam
3 Replies

6. UNIX for Advanced & Expert Users

Permission denied, but user is owner and has group ownership too

Folks, I have a problem with a particular file, that seems to have some kind of lock on it, that takes around 1 hour approx to timeout. I have used lsof and nothing has an open file handle on it, yet I cannot open it. My user/group owns the file and I can create edit/delete files in... (6 Replies)
Discussion started by: scottrus
6 Replies

7. Shell Programming and Scripting

automatically change owner and group

We have a program that when a new account is created using the webpage it creates a new directory on the linux filesystem for the account. The problem is the process that creates the directory is as root user, as I want ftpuser to be able to login I have to manually login and chown -R the... (1 Reply)
Discussion started by: borderblaster
1 Replies

8. Programming

how I know owner of file and its permission through c program

Helo I havea particular file. how I know ownerof the file as well as file permission using c program. Regards, Amit (4 Replies)
Discussion started by: amitpansuria
4 Replies

9. Linux

How to changed Permission on Tape

I am unable to backup file on my tape drive # mt -f /dev/st0 status SCSI 2 tape drive: File number=0, block number=0, partition=0. Tape block size 0 bytes. Density code 0x25 (DDS-3). Soft error count since last status=0 General status bits on (45010000): BOT WR_PROT ONLINE IM_REP_EN #... (6 Replies)
Discussion started by: real-chess
6 Replies

10. Shell Programming and Scripting

permission, owner and group

hello I search a script (ksh for Aix 5.3) to save all permissions, groups and owner for all files. Because we work much to change it, and a mystake ......! So i want execute this script to save/ execute permissions for all files. If you have this script, thank you for your help ;) best... (2 Replies)
Discussion started by: pascalbout
2 Replies
Login or Register to Ask a Question