How to copy user policy from a server to another one?


 
Thread Tools Search this Thread
Operating Systems AIX How to copy user policy from a server to another one?
# 1  
Old 09-22-2015
How to copy user policy from a server to another one?

Hi

I would like to copy some user policy ( such as login time out , password expired time, number of failed login before user is locked, ... ) from one server to another server. I had copied necessary files ( in /etc and /etc/security ) to new server, but something didn't work.

I guess that I have to reboot server, but I don't want to do that. May I reboot some services in this case, so that all the policy would work ??. If yes, which services ???

Thank for read.
# 2  
Old 09-22-2015
Q: Are the user present on both servers? With same passwd? ( and so hoem directories exist etc...)
This User Gave Thanks to vbe For This Post:
# 3  
Old 09-22-2015
Quote:
Originally Posted by bobochacha29
I had copied necessary files ( in /etc and /etc/security ) to new server, but something didn't work.
I realy hope you have a made backup of these files.

Which files have you copied so far?

I would suggest to copy the /etc/security/login.cfg and
(only) the "default:" Stanza from /etc/security/user.


Quote:
Originally Posted by bobochacha29
I guess that I have to reboot server, but I don't want to do that.
There is no need to reboot the server.

Regards
This User Gave Thanks to -=XrAy=- For This Post:
# 4  
Old 09-22-2015
If you want to clone a bunch of users, it might be better to use the output from lsuser as root (you get more information) to build a deck of mkuser commands, ensuring that the groups names match in advance.

You would need to keep the UID & GID numbers the same, especially if there is NFS involved or you move data with tar or other methods that put back permissions.

As for copying the password details, this is fraught with danger. You would be best to ensure you get a quiet time and do a big edit to replace the specific passwords and other attributes in /etc/security/passwdone at a time having taken a backup copy first. There is a serious risk that you could leave yourself unable to login to your target server.

You will also need to consider if/how you use ssh keys, remote login and any ftp restrictions that might be in place. There may of course be other software installed or applications that have their own account management too.


Are you wanting to duplicate the whole server by any chance? If so, then mksysb is a better way, although you have to be careful you boot without the network plugged in first time else you will get IP conflicts with the current live server.



Robin
This User Gave Thanks to rbatte1 For This Post:
# 5  
Old 09-22-2015
Files I copied to new server ( same OS version )

Code:
/etc/group  
/etc/passwd 
/etc/security/group  
/etc/security/limits  
/etc/security/passwd 
/etc/security/.ids  
/etc/security/environ  
/etc/security/.profile
/etc/security/login.cfg  /
/etc/security/user


Last edited by rbatte1; 09-23-2015 at 01:13 PM.. Reason: CODE tags
# 6  
Old 09-23-2015
OK but what about the users? Their home directories??? the one you see in /etc/passwd... Then you might have mismatches between the content found in the user's .ssh directory ( yes the public keys ... the local keys wont match with the server where you copied...) etc...
This User Gave Thanks to vbe For This Post:
# 7  
Old 09-23-2015
Quote:
Originally Posted by bobochacha29
I would like to copy some user policy ( such as login time out , password expired time, number of failed login before user is locked, ... )
Unix does not deal with "policies", there are just (access) rights: read, write and execute. What you are after is spread out over several different portions of the OS software:

login time out if you mean a time of inactivity after which a user is logged out: this is a shell variable, called "TMOUT", which is usually set in /etc/enviroment as a read-only variable. Many security auditors insist on it, but it is idiotic (meaning: it doesn't serve the proposed purpose in any way), it can easily be circumvented and it might even be harmful without any practical gain. My suggestion is not to implement it at all.


password expired time is a property of the user account and you should use the chuser (mkuser for new users) command to set or change it.

number of failed login before user is locked same as above.

Quote:
Originally Posted by bobochacha29
I guess that I have to reboot server
No, not at all. Booting loads a new kernel image into memory. Have you changed anything on the kernel? No! Therefore....

Quote:
Originally Posted by vbe
OK but what about the users? Their home directories??? the one you see in /etc/passwd...
The users are created by copying /etc/passwd, but about the home-directories and their contents, ssh-keys and similar information you are absolutely right.

As rbatte1 has already said: ONLY USE THE OS COMMANDS to do things, do not dabble around in configuration files - at least not to achieve ordinary things like creating/changing users and definitely not as long as you are not 1000% sure what you do.

Rule of thumb: if you have to ask how you should not do it at all.

PS: the perhaps cleanest way to implement uniform user accounts across a scenery of systems is to use some system designed for that: Kerberos, LDAP, NIS, NISplus, DCE, X.500, ....

I hope this helps.

bakunin
These 2 Users Gave Thanks to bakunin For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

2. Shell Programming and Scripting

Shell script to copy a file from one server to anther server and execute the binary

Hi , Is there any script to copy a files (weblogic bianary + silent.xml ) from one server (linux) to another servers and then execute the copy file. We want to copy a file on multiple servers and run the installation. Thanks (1 Reply)
Discussion started by: Nawrajesh
1 Replies

3. Linux

User Account Policy

Hi, i have the following config in the system-auth files auth required /lib/security/$ISA/pam_env.so auth sufficient /lib/security/$ISA/pam_unix.so likeauth nullok auth required /lib/security/$ISA/pam_deny.so account required ... (2 Replies)
Discussion started by: yprudent
2 Replies

4. Shell Programming and Scripting

Copy folder and files from unix server to linux server

We would be migrating unix solaries to Linux redhat. Basically source is unix and target is linux. i would like to copy entire file system unix/source/* to target linux/souce/* but target linux has only folder setup so what ever files copied need to be placed in the linux server with same... (8 Replies)
Discussion started by: balajikalai
8 Replies

5. Ubuntu

User and Password Policy

Hi linux expert, i would like to create a script for listing all user with there password policy. It should be in the following format: Last password change : Sep 19, 2011 Password expires : never Password inactive : never Account... (2 Replies)
Discussion started by: yprudent
2 Replies

6. Solaris

password policy for new user

hi folk, i try to setup a new password policy for our solaris box user, below are the /etc/default/passwd/, but then when i tried to create a user, it didn't ask for numeric character, and the new password also didn't ask for special characters. # useradd testing # passwd testing New... (7 Replies)
Discussion started by: dehetoxic
7 Replies

7. Solaris

how to assign group policy to user in solaris

hi, how to assign group policy to user in solaris (1 Reply)
Discussion started by: meet2muneer
1 Replies

8. Shell Programming and Scripting

copy files from remote server (B) to target server (A)?

Hi All, what is the comand to log off the remote server? I have 2 servers A, B. I need to find all files older than 7 days on server B and copy over to server A. My logic is: login the remote server: ================= ssh hostB cd /data/test find . -mtime -7 -ls | awk '{print... (4 Replies)
Discussion started by: Beginer0705
4 Replies
Login or Register to Ask a Question