Move all user setting


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Move all user setting
# 1  
Old 05-13-2005
Move all user setting

I have a new server ( host A ) and a existing server ( host B ) , I will move all data from host A to host B , could suggest what is the best method to move all the user data including /etc/passwd . /etc/shadow , /etc/group , ~userid/.bash_profile , /home , how to make the user can use the same password after move the server ? thx
# 2  
Old 05-13-2005
for /etc/passwd and /etc/shadow --- just grep out the user entries and append them into the appropriate files in the new servers so the uid, gid and passwords for the users stay the same ... a lot of places use the same group file entries so if this is the case with you, you can just copy over /etc/group to the new host also ...
Code:
for i in passwd shadow
do
    egrep -v "root|lp|smtp" /etc/$i > /tmp/$i
    scp /tmp/$i newhost:/tmp/$i
    ssh newhost "cat /tmp/$i >> /etc/$i; rm /tmp/$i"
    rm /tmp/$i
done
scp -p /etc/group newhost:/etc/group

for the home-related files and directories (i.e., .bash_profile, etc.), just copy them over ... if you have remote root ssh access on the remote server you can do the code below ... (change the correct paths to the user data directories on both local and remote hosts) ... for rsh access only, change the ssh to rsh ...
Code:
cd /home
tar cvfp - * | ssh newhost "cd /newhomedir; tar xvfp -"
tar cvfp - .[a-zA-Z0-9]* | ssh newhost "cd /homedir; tar xvfp -"

=========
or ... if you are not automounting home directories ...
=========

tar cvfp - /home | ssh newhost "cd /; tar xvfp -"

=========
or ... if you are automounting home directories ... (sample assumes it is automounted from /export/home) ...
=========

(cd /export; tar cvfp - home) | ssh newhost "cd /export; tar xvfp -"

there other transfer options you can use ... see "man dd", "man ufsdump", etc. depending on your OS platform ...
# 3  
Old 05-14-2005
does linux has a command can do that ? thx
# 4  
Old 05-14-2005
Quote:
Originally Posted by ust
does linux has a command can do that ? thx
everything in Just Ices post will work, with the possible exception of egrep, which is sometimes not there and which you can just change to grep.
# 5  
Old 05-14-2005
thx replies,

autcally I want to copy the user from unix to linux , I remember a command can do that , could advise ? thx
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Setting write permission for particular user

Hi All, We have a scenario in production where we want only one user from a group to modify the file. The file is not set to write permission for application manager. -r--r--r-- 1 amgr u00 15661716 Aug 30 00:06 DCI.dat So here amgr will have permission to edit the file. We want a... (10 Replies)
Discussion started by: arunkumar_mca
10 Replies

2. UNIX for Dummies Questions & Answers

How to move file from one directory to other of only particular user?

I written unix script where a pdf file generates. But if the script is used by multiple people at a time it generates same pdf with two different owner names and creating a problem with permission while moving the file. is there a way where i can move the file filtering with the user? (4 Replies)
Discussion started by: lakers646
4 Replies

3. Solaris

Is there a difference between setting a user as nologin and setting it as a role?

Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users. In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies

4. Shell Programming and Scripting

Move Process ID from one user to another

HI, I'm search to transfer a process ID form the User A to the User B with out super user privilege. Would it be possible. Please leave your (1 Reply)
Discussion started by: Prabhu.Are
1 Replies

5. Red Hat

setting ulimit for a user

The root user runs the following ulimit -a | grep open and gets a result of open files (-n) 8162 A user runs the same command and gets a result of open files (-n) 2500 How can you set the ulimit of the user to... (2 Replies)
Discussion started by: jsanders
2 Replies

6. UNIX for Dummies Questions & Answers

PATH Setting for all shells of a user

How can I modify the path variable of a particular user in all shells? I searched in this forum and as per the advice in some threads created a new file .profile in $HOME directory with the new PATH, but it did not work. (5 Replies)
Discussion started by: JoyceBabu
5 Replies

7. UNIX for Advanced & Expert Users

Switch user :NOPASSWD setting

Hi All, I want trigger a script "abhishektest.sh "whenever a mail come to a user say "abhishek" in my unix server. I dont have root permission. So, for doing this i added abhishek : "|/export/abhishek/bin/wr_test.sh in /etc/mail/aliases in wr_test file : i need to put this line, as i... (2 Replies)
Discussion started by: mindtee_abhi
2 Replies

8. UNIX for Advanced & Expert Users

setting password for user using useradd?

hi all i am writing a script to create user and group from the input given to script for eg. script needs to values 1. mode - 1 or 2 2. id - if mode is 1 then id should be 2 char like x1 / v1 / v2 if mode is 2 then id should be 1 char like x / v / e from these to values group is... (1 Reply)
Discussion started by: zedex
1 Replies

9. Solaris

Setting user groups

Hi......... I'm trying to set a group of users to login to do a required super-user tasks without knowing the super-user passwd. For example...a user popodude logs in as self with passwd..system accepts the password & then automatically asks for the super-user account passwd. My goal is... (1 Reply)
Discussion started by: Remi
1 Replies
Login or Register to Ask a Question