关于centos 快速搬移用户的一些纪录
要从A服务器搬使用者到B服务器的一些方法
机器作搬移,想要偷懒用比较快速的方法做搬移
于是用上了rsync
cd /home
rsync -av --delete ./* root@B/home/
搬完过去后再把
/etc/passwd
/etc/group
这两个档案把要的user 复制粘贴过去就好了
切换过去简单测试了一下,就以为结束了
后来有公司的同学反映ssh 不上去
看了一下log
# tail -f /var/log/secure
Nov 27 05:36:51 B sshd[8512]: fatal: Access denied for user jason by PAM account configuration
Nov 27 05:36:53 B sshd[8514]: fatal: Access denied for user jason by PAM account configuration
Nov 27 05:36:56 B sshd[8516]: fatal: Access denied for user jason by PAM account configuration
后来发现是 /etc/shadow 这个档案出了问题
再把相对应的user 拷过来就可以运行了
后来去cyberciti 查了一下,才了解到这个档案的用处。
Q. Can you explain /etc/shadow file used under Linux or UNIX?
A. /etc/shadow file stores actual password in encrypted format for user’s account with additional properties related to user password i.e. it stores secure user account information. All fields are separated by a colon (:) symbol. It contains one entry per line for each user listed in /etc/passwd file Generally, shadow file entry looks as follows (click to enlarge image):
1.User name : It is your login name
2.Password : It your encrypted password. The password should be minimum 6-8 characters long including special characters/digits
3.Last password change (lastchanged) : Days since Jan 1, 1970 that password was last changed
4.Minimum : The minimum number of days required between password changes i.e. the number of days left before the user is allowed to change his/her password
5.Maximum : The maximum number of days the password is valid (after that user is forced to change his/her password) Warn : The number of days before password is to expire that user is warned that his/her password must be changed Inactive : The number of days after password expires that account is disabled
6.Expire : days since Jan 1, 1970 that account is disabled i.e. an absolute date specifying when the login may no longer be used
[serverfault.com] : http://serverfault.com/questions/540004/ssh-access-denied-by-pam-account-configuration-for-one-non-root-user-but-not
[cyberciti.biz] : http://www.cyberciti.biz/faq/understanding-etcshadow-file/