Hi
I have several servers with different users and I need to group them into a single server. So I need to add old users from external servers to a passwd and shadow files.
There are several things in which I am not sure how it works.
It is possible to edit the passwd and the shadow file in runtime? So that I can for example copy the shadow and passwd file from /etc/... to a temporary directory (passwd.back shadow.back). Here I delete the unneeded users and add the new from the external servers with - cat shadow_old >> shadow.back. (here the shadow_old contains only the needed users from the other server, the system and other users are deleted from it) This way I get a shadow.back with new users inserted into it from another shadow file (same for passwd). The root and the system users stays the same.
Can I this manually formatted shadow and passwd file just copy from the temporary directory to the running servers /etc/shadow and /etc/passwd file?
Code:
NEWSERVER ORIGINAL:
/etc/passwd
root:x: ...
bin:x: ...
deamon:x: ...
...
user1:x: ...
user2:x: ...
cp /etc/passwd /temp/passwd.back
*********************************************
OLDSERVER:
cp /etc/passwd /temp/passwd_old
(remove every sys user, leave only users within a certain UID range)
user3:x: ...
user4:x: ...
cat /temp/passwd_old >> /temp/passwd.back
cp /temp/passwd.back /etc/passwd
(SAME FOR SHADOW)
I take care about the UIDs and home-directories of course. (I mean there will be no users with same UID)
Will this work?
One more question - are there any illegal characters which cannot be used in /etc/passwd file???
Just curious because the webmin allows you to put into a shadow any type of character. I noticed that when the local admins started to put strange characters in the full names of users there appeared for example the semicolon ';'. (local cauntry special characters like - š,ľ,č.é ...) When I saw this I started to thinking about what would happen if some of this guys put into this section the ':' character.
Thanks for your help.