How to write bash script for creating user on multiple Linux hosts?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to write bash script for creating user on multiple Linux hosts?
# 36  
Old 02-26-2013
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check connectivity with multiple hosts - BASH script available here

Hi everyone! Some time ago, I had to check connectivity with a big list of hosts, using different formats (protocol://server:port/path/, server:port, ....). I developed a script that checks the connectivity using different commands (ping, telnet, nc, curl). It worked for me so I'm sharing it... (9 Replies)
Discussion started by: Fr3dY
9 Replies

2. Shell Programming and Scripting

Bash script to detect nonpingable hosts

I have a script to detect if a host is pingable or not. The problem is that I would like it to put the nonpingable hosts in one file and the pingable hosts in another. I have come up with this so far: for ip in `cat /tmp/testlist2`; do ping -c 3 $ip >/dev/null && echo "$ip is up" || echo "$ip... (5 Replies)
Discussion started by: newbie2010
5 Replies

3. Shell Programming and Scripting

Running a script on multiple remote hosts at once

I have a script on about 15 hosts that I need to run for each host whenever I want (not crontab). Problem is, this script takes 5-10 mins to run for each host. Is there a way I can run the script in parallel for all the hosts instead of 1 at a time? Also, I'm remotely running the script on the... (3 Replies)
Discussion started by: mrskittles99
3 Replies

4. Shell Programming and Scripting

script to reboot multiple hosts

Hi Expert, How to create a script to reboot multiple hosts in linux? Thank you. (5 Replies)
Discussion started by: regmaster
5 Replies

5. SuSE

creating user on SUSE Linux

Hi I need to create a user who can have access on only one folder. for example I created a user "test" . he should have access only on folder /testfolder. The problem is that the user will mostly use FileZilla to ftp his files in the testfolder. In the fileZilla , i want him to be... (21 Replies)
Discussion started by: SystemEng
21 Replies

6. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

7. Shell Programming and Scripting

How to write bash script to explode multiple zip files

I have a directory full of zip files. How would I write a bash script to enumerate all the zip files, remove the ".zip" from the file name, create a directory by that name and unzip each zip file into its corresponding directory? Thanks! Siegfried (3 Replies)
Discussion started by: siegfried
3 Replies

8. Shell Programming and Scripting

script for df output from multiple hosts

I am trying get "df -k" output from multiple hosts along with their hostnames via ssh, my script is appending the "df -k" output from all the nodes to a single file but not getting the hostnames for those nodes, just wondering how to pass more than one command via ssh or may be someone could come... (6 Replies)
Discussion started by: barkath
6 Replies

9. UNIX for Dummies Questions & Answers

[LINUX] Creating new user accounts

I've had Linux when I was young, on one of our first computers and learned it pretty quickly... However, I've been working on Windows for about 7 years now and just made the switch back to Linux, Mandrake 9.1. So I have some problem with creating new user accounts. I could create one, but once I... (3 Replies)
Discussion started by: Arendo
3 Replies

10. UNIX for Dummies Questions & Answers

Creating user ids on multiple systems simultaneously

I am trying to think of a way to create user ids on multiple Linux systems in one fell swoop without logging onto each system indivually. Is there a way to do this with ssh commands? I don't want to use NIS/LDAP solution just a simple shell script utilitarian methodoloy would suffice. Also, I am... (1 Reply)
Discussion started by: darthur
1 Replies
Login or Register to Ask a Question
MUSSH(1)							   MUltihost SSH							  MUSSH(1)

NAME
mussh - MUltihost SSH SYNOPSIS
mussh [ OPTIONS ] <-h host... | -H hostfile > [-c cmd ] [-C scriptfile ] DESCRIPTION
mussh is a shell script that allows you to execute a command or script over ssh(1) on multiple hosts with one command. When possible mussh will use ssh-agent(1) and RSA/DSA keys to minimize the need to enter your password more than once. OPTIONS
--help Prints full help text. -d Same as -d 1 -d 0 Turns debug mode off. -d 1 On STDERR prints out basic actions and ssh-agent activity and which host is being connected to. -d 2 Includes all of the output from -d1, the list of hosts, the command/script as it will be executed on each host, and a lot more. -v Same as -v 1 -v 1 Sets ssh in debug1 mode by passing "-v" to ssh. -v 2 Sets ssh in debug2 mode by passing "-v -v" to ssh. -v 3 Sets ssh in debug3 mode by passing "-v -v -v" to ssh. -m [n] Run concurrently on 'n' hosts at a time (asynchronous). Use '0' (zero) for infinite. (default) -q No output unless necessary. This will cancel -d and -v if after them on the command line. It also suppresses the output of each host. This will NOT suppress the password/passphrase prompts required to log into each host. -i <identity> [identity ..] Load an identity file. When -i is used, the specified identity file(s) is loaded instead of the default identity. You can load as many RSA/DSA identities as you'd like. -o <ssh-args> Args to pass to ssh with -o option. See the ssh(1) man page for more info on the -o option. -a Force loading ssh-agent. Without this flag, mussh will not load another agent when one is already loaded. -A Do NOT load ssh-agent. If no agent is loaded you will be prompted for a password or passphrase by ssh for each host. If you do not have RSA/DSA keys for the destination hosts, this will save you some hassle. -b Print each hosts' output in a block without mingling with other hosts' output. -B Allow hosts' output to mingle. (default) -u Unique. Eliminate duplicate hosts. (default) If you a host or user@host occurs more than once across files specified with -H or hosts specified with -h, the host or user@host is used only once. -U Do NOT make host list unique. This simply overrides the -u flag. This will cause scripts to be executed on duplicate hosts once per listing. -P Do NOT fall back to passwords on any host. This will skip hosts where keys fail. If you use this with '-d' you'll still see which hosts failed. -l <login> Use 'login' when no other is specified with hostname. -L <login> Force use of 'login' name on all hosts. These can be handy for adding 'root@' to hostnames kept in a file for -H option. With -h it means you get to type less. -s <shell> Path to shell on remote host. (Default: bash) -t <secs> Timeout setting for each session. (requires openssh 3.8 or newer) -V Print version info and exit. PROXY ARGS
-p [user@]<host> Host to use as proxy. (Must have mussh installed) -po <ssh-args> Args to pass to ssh on proxy with -o option. HOST ARGS
-h [user@]<host> [[user@]<host> ..] Add a host to list of hosts. May be used more than once. -H <file> [file ..] Add contents of file(s) to list of hosts. Files should have one host per line. Use "#" for comments. COMMAND ARGS
If neither is specified, commands will be read from standard input. -c <command> Add a command or quoted list of commands and args to list of commands to be executed on each host. May be used more than once. -C <file> [file ..] Add file contents to list of commands to be executed on each host. May be used more than once. PROXY MODE
When proxying, mussh can use a single remote server to as a bastion host. All hosts will be connected to from the central host rather than from the computer where you are initially running mussh. This can be handy when you only have access to one machine behind a firewall. The proxy host must have OpenSSH 2.3 or greater, or an sshd that works with ForwardAgent under ssh2. Proxy server must also have mussh installed in your PATH. To verify that it is in your path use "ssh user@proxy 'which mussh'". Use "ssh user@proxy 'echo $PATH'" to deter- mine what your path is. SSH-AGENT INTERACTION Assuming that you're not turning off the agent with '-A' mussh will attempt to use ssh-agent(1). Normally mussh will get rid of the agent when it exits. See EXAMPLES for examples. EXAMPLES
There is an EXAMPLES file with detailed examples. The basic command: $ mussh -h foo bar baz A simple command: $ mussh -h foo bar baz -c 'rpm -e emacs' A simple command asynchronously: $ mussh -h foo bar baz -c 'rpm -e emacs' -m Using a specific key: $ mussh -h foo bar baz -c 'rpm -e emacs' -i ~/.ssh/my_other.key Loading a list of hosts from a file: $ mussh -H /tmp/hostlist.txt -c 'rpm -e emacs' Loading a script from a file: $ mussh -h foo bar baz -C /tmp/scriptfile.sh BUGS
Please report any bugs at http://sourceforge.net/projects/mussh/ AUTHOR
Dave Fogarty <doughnut at doughnut dot net> SEE ALSO
ssh(1), ssh-agent(1) Doughnut August 2005 MUSSH(1)