System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create users in all hpux and linux system

 
SOLVED
Go to solution
senthil_kumar_1
Super Advisor

How to create users in all hpux and linux system

Hi

We have lot of hpux and linux systems.

so we need automated script to create users in all hpux and linux servers.
7 REPLIES
Jeeshan
Honored Contributor
Solution

Re: How to create users in all hpux and linux system

check the attached script and edit as per your environment.
a warrior never quits
Steven E. Protter
Exalted Contributor

Re: How to create users in all hpux and linux system

Shalom,

You should consider a master/server protocol like NIS or LDAP so when you create a user on the master its created on all other systems.

These are tools designed for the job.

If you want to do it without these tools then follow this document:

http://www.hpux.ws/?p=10

Write your user add script to run the list and



while read -r systemname
do
ssh $systemname command
done < system_list


command is a script on each system that adds the user.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ganesan R
Honored Contributor

Re: How to create users in all hpux and linux system

Hi,

If you have established password less ssh login between one source sever(where script being executed) and other servers(where users needs to be created), you can achieve this by simple shell script.
Best wishes,

Ganesh.
Ganesan R
Honored Contributor

Re: How to create users in all hpux and linux system

Hi,

For password less login, follow these steps.

1.Login to serverA as user1.

2.$ssh-keygen -t dsa
Press enter for all the questions.It will create the private/public keys
under $HOME/.ssh/
File names are id_rsa and id_rsa.pub

3.Now you need to copy the id_rsa.pub file content into ServerB $HOME/.ssh/authorized_keys file
ServerA#scp ~user1/.ssh/id_rsa.pub ServerB:/tmp

Login to ServerB server

ServerB#cat /tmp/id_rsa.pub >> ~user1/.ssh/authorized_keys

Make sure the following permissions on serverB.

Home directory should have 755 permission (users home directory)
$HOME/.ssh directory should have 700 permission
$HOME/.ssh/authorized_keys file should have 600 or 640 permission
Best wishes,

Ganesh.
senthil_kumar_1
Super Advisor

Re: How to create users in all hpux and linux system

Hi ahsan,

pls explain that script.
Jeeshan
Honored Contributor

Re: How to create users in all hpux and linux system

Read the script.

There is commentary inside that says about the script.
a warrior never quits
Steven E. Protter
Exalted Contributor

Re: How to create users in all hpux and linux system

Shalom,

There is little practical difference between the script posted and my link.

Its just a step by step guide to accomplish your goal.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com