10-05-2006
Hardcoding root passwords inside a script is a bad idea. For the script to be executable, it has to be readable by users, and any user that can read this script can see the root password. And that is not a great idea.
It probably would better to put a setuid c wrapper around this shell script so that you don't have to do su to root.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
All,
I want to run a non-root script as the root user with non-root environment variables with crontab. The non-root user would have environment variables for database access such as Oracle or Sybase. The root user does not have the Oracle or Sybase enviroment variables. I thought you could do... (2 Replies)
Discussion started by: bubba112557
2 Replies
2. Shell Programming and Scripting
we have this script that stops, starts and monitor process scheduler. prcs_control. this script runs perfectly when executed by ps_user.
we are now creating a new script that will run this script and is executed by root. this script needs to execute the prcs_control as ps_user because root can... (1 Reply)
Discussion started by: tads98
1 Replies
3. Shell Programming and Scripting
Hi All,
Am using the below command to start my application using the root user
su - bin -c "/home/bin/test/start.sh"
but am getting the error becaue i have set some environment varibales in bin's .profile
when i execute the command start.sh by logging directly into bin account it's... (9 Replies)
Discussion started by: ravi.sri24
9 Replies
4. Shell Programming and Scripting
It needs be root for some command and not for other commands.
fdisk -l
ls -l
cd /etc
For fdisk -l need root password.
After fdisk -l i want to be again a normal user.
How can i this with shell script? (4 Replies)
Discussion started by: cola
4 Replies
5. Shell Programming and Scripting
So I have a script that runs as a non-root user, lets say the username is 'xymon' .
This script needs to log on to a remote system as a non-root user also and call up a bash script that runs another bash script as root.
in short: user xymon on system A needs to run a file as root user and have... (2 Replies)
Discussion started by: damang111
2 Replies
6. Solaris
Hi All
After downloading ZFS documentation from oracle site, I am able to successfully migrate UFS root FS without zones to ZFS root FS. But in case of UFS root file system with zones , I am successfully able to migrate global zone to zfs root file system but zone are still in UFS root file... (2 Replies)
Discussion started by: sb200
2 Replies
7. Shell Programming and Scripting
I am writing a korn shell script where i need to switch to root in between and again exit from root to normal user and continue other commands.
Is that possible to switch between these two in the same script? (1 Reply)
Discussion started by: santosh2626
1 Replies
8. Red Hat
Hi Guys
In red hat linux server is there a way to alert via email when the root password is about to expire ?
As per security policy in our environment root password will expire in 90 days.
Example : It would be better if we receive a email on 7th november stating that the root password... (1 Reply)
Discussion started by: newtoaixos
1 Replies
9. Shell Programming and Scripting
local script:
cat > first.sh
cd /tmp
echo $PWD
echo `whoami`
cd /tmp/123
tar -cvf 789.tar 456
sleep 10
except script:
cat > first
#!/usr/bin/expect
set ip 10.5.15.20
set user "xyz123"
set password "123456"
set script first.sh
spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies
10. Programming
hi all,
i think i have got the solution for this but want to run it past you guys first
when i run a script sometimes its necassary to sudo to root so it can create users, chmod etc etc, the normal way for me doing this is just to simply run the script as root
but i have created a user... (11 Replies)
Discussion started by: robertkwild
11 Replies
LEARN ABOUT DEBIAN
passmass
PASSMASS(1) General Commands Manual PASSMASS(1)
NAME
passmass - change password on multiple machines
SYNOPSIS
passmass [ host1 host2 host3 ... ]
INTRODUCTION
Passmass changes a password on multiple machines. If you have accounts on several machines that do not share password databases, Passmass
can help you keep them all in sync. This, in turn, will make it easier to change them more frequently.
When Passmass runs, it asks you for the old and new passwords. (If you are changing root passwords and have equivalencing, the old pass-
word is not used and may be omitted.)
Passmass understands the "usual" conventions. Additional arguments may be used for tuning. They affect all hosts which follow until
another argument overrides it. For example, if you are known as "libes" on host1 and host2, but "don" on host3, you would say:
passmass host1 host2 -user don host3
Arguments are:
-user
User whose password will be changed. By default, the current user is used.
-rlogin
Use rlogin to access host. (default)
-slogin
Use slogin to access host.
-ssh
Use ssh to access host.
-telnet
Use telnet to access host.
-program
Next argument is a program to run to set the password. Default is "passwd". Other common choices are "yppasswd" and "set
passwd" (e.g., VMS hosts). A program name such as "password fred" can be used to create entries for new accounts (when run as
root).
-prompt
Next argument is a prompt suffix pattern. This allows the script to know when the shell is prompting. The default is "# " for
root and "% " for non-root accounts.
-timeout
Next argument is the number of seconds to wait for responses. Default is 30 but some systems can be much slower logging in.
-su
Next argument is 1 or 0. If 1, you are additionally prompted for a root password which is used to su after logging in. root's
password is changed rather than the user's. This is useful for hosts which do not allow root to log in.
HOW TO USE
The best way to run Passmass is to put the command in a one-line shell script or alias. Whenever you get a new account on a new machine,
add the appropriate arguments to the command. Then run it whenever you want to change your passwords on all the hosts.
CAVEATS
Using the same password on multiple hosts carries risks. In particular, if the password can be stolen, then all of your accounts are at
risk. Thus, you should not use Passmass in situations where your password is visible, such as across a network which hackers are known to
eavesdrop.
On the other hand, if you have enough accounts with different passwords, you may end up writing them down somewhere - and that can be a
security problem. Funny story: my college roommate had an 11"x13" piece of paper on which he had listed accounts and passwords all across
the Internet. This was several years worth of careful work and he carried it with him everywhere he went. Well one day, he forgot to
remove it from his jeans, and we found a perfectly blank sheet of paper when we took out the wash the following day!
SEE ALSO
"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995.
AUTHOR
Don Libes, National Institute of Standards and Technology
7 October 1993 PASSMASS(1)