su command without password prompt to non-root account


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users su command without password prompt to non-root account
# 1  
Old 01-02-2009
Bug su command without password prompt to non-root account

Hello. I searched the internet for answers and don't seem to find any for about a day now.

My problem. I want to su to a non-root account non-interactively, e.g. if I want to temporarily become prdusr, I want to su prdusr without keying prdusr's password every time.

What I want is something that works like sudo -S command where I can pipe a protected password file into sudo -S.

e.g. root has granted prdusr the power to kill any job so right now I can run script with the following commands to kill job without any password prompt :

cat passwd.txt | sudo -S prdusr kill $PID (where passwd.txt contains prdusr's password and $PID contains the process id to be killed)

I want to be able to switch to prdusr using similar strategy without the password prompt everytime.

Doesn't look like I can do this as most answers I found on the internet is for su root only.
# 2  
Old 01-03-2009
You should take a look at your sudoer conf file. There you should be able to setup prdusr to be called without asking for a password.
# 3  
Old 01-03-2009
Bug su command to non-root without password prompt

Thank you for your reply. I am not the root here. Someone is. The prdusr is shared by the production support team. I am one of the team members who wants to write a little alias to avoid entering the password every time I su prdusr.

The password also changes once a month for prdusr so to eliminate the password prompt completely might not go well with the production support team and defeats the purpose of the password protected prdusr.

Is there anyway I can ask Root to make use of sudo -S and treat su prdusr as if temporarily executed as if I was root ?

Root grants prdusr priviledge to kill any job but when prdusr executes sudo kill, it still prompts for password of prdusr. So what I was hoping is

cat passwd.txt | sudo -S su prdusr would allow me to switch to prdusr without a password prompt if root grants su prdusr 'command' priviledge to prdusr ?

It is very confusing because su prdusr might not be a command to unix kernel and su prdusr executed by root doesn't require a password prompt which only comes from the nature of sudo setup.
# 4  
Old 01-06-2009
Okay, I've managed to confuse myself. Does sudo ask you for your password, or prdusr's? If it asks you for yours, then its just sudo demanding the password and -S might work. But if it asks for pdrusr's, it's su asking for the password, not sudo, which seems to ignore redirects by reading from the terminal itself rather than stdin. An expect script might be useful, maybe.

Last edited by Corona688; 01-06-2009 at 04:14 PM..
# 5  
Old 01-06-2009
Your admins allow you to have a password in a file, especially a file called passwd.txt?
Padow
# 6  
Old 01-07-2009
su command to non-root without password prompt

Thank you to every one who looked into my question and responded.

I asked root the same question and he sugguested putting my unix account into sudo list to let me su prdusr without specifying a password.

He did that and it satisfies my requirement that I don't have to remember prdusr's password and have to enter it every time I su prdusr.

Now I just sudo su prdusr and no password prompt. My understanding of it is he temporarily lets my unix account has root priviledge when I sudo su prdusr only. If I su prdusr, there is still a prompt for prdusr password. If I su anyother user, I still need to supply that user's password.

I don't need to pipe a password.txt file to sudo su prdusr command. I meant to post this answer for everyone but your responses remind me to do this. Hope this thread would be useful for others too.
# 7  
Old 01-07-2009
Question here.

Are you 'sudo su prdusr' from another account other then prdusr? If YES this is a huge security risk if you are not using passwords. Not requiring a password when switching to this user means anyone could switch to this user and have the same rights. Big No No in the real world.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Sudo command prompt for a password

in the /etc/sudoer file this line was added: wtolentino ALL=(ORACLE) NOPASSWD: /bin/chmod when i tried to run this command sudo -u oracle /bin/chmod 775 /appshared/applications/lpa/executables/chrpt001.rep it prompts me for a password for example: $ pwd /appshared/applications/lpa... (2 Replies)
Discussion started by: wtolentino
2 Replies

2. Linux

How to make this command work wihtout password prompt?

Hi, I am trying to run this command to connect to each server without being prompted for the password. How can I do this in Linux redhat 7.2: for HOST in $VIPS; do su - Myadminid -c "ssh -o ConnectTimeout=10 $HOST 'date; hostname; pkill -9 -f -u Myadminid xx00 ; ps -ef |grep Myadminid'" ... (7 Replies)
Discussion started by: mrn6430
7 Replies

3. Solaris

Not getting command prompt after entering the login password

Hi All, I am not able to get the command prompt after entering the login password on solaris server Only access is through console. Server type : sun4u sparc SUNW,Netra-T12 bsnl-north-in > ssh 10.147.17.207 jtoin Connecting to 10.147.17.207 as user jtoin Password: Last login: Wed Mar 5... (1 Reply)
Discussion started by: sandeep_kmehra
1 Replies

4. Solaris

Console - root command prompt displayed twice after hitting enter

Dear All, I hope you can help me. I have a pair of E2900's I've inherited. Both running Solaris 9. Both have LOM> consoles. The problem I'm experiencing only occurs when connected to the /dev/console tty. Whenever I hit 'Enter' for a new line, I receive two new lines: - myhost# ... (11 Replies)
Discussion started by: aleith
11 Replies

5. Debian

password less login to root from a user account

hello friends, one user is created named "user1" I login as "user1" . Now when i do "su -" to be root user I have to give password for root . Is there any way through which we can skip giving the password to root. i.e. user1@work:~$ su - Password: xxxxxx work:~$ I don't want that... (1 Reply)
Discussion started by: pradeepreddy
1 Replies

6. Solaris

Solaris 8 - Asks for current root password when trying to change root password.

Hello All, I have several solaris boxes running Solaris 8. When changing root passwords on them, all will simply ask for the new root password to change and of course to re-type the new password. One of the systems however asks for the existing root password before it will display the new password... (8 Replies)
Discussion started by: tferrazz
8 Replies

7. UNIX for Dummies Questions & Answers

Change other account password from root access

Hi, I have forgotten my personal account password but I still have the root access to the box. Please tell me how can I change my other account password by logging as root. Thanks. Rakesh :D (4 Replies)
Discussion started by: rakeshou
4 Replies

8. AIX

Root login does not prompt for password

I've an LPAR set up on a P690. The LPAR ran AIX v5.2. I then did an upgrade (using the migration option) to AIX v5.3. I've now encountered the problem that, at the console, I cannot log in as root (or as anyone else that matter). I get the login prompt, enter "root " and then the shell returns to... (1 Reply)
Discussion started by: morgan_g
1 Replies

9. UNIX for Dummies Questions & Answers

I need it to prompt me for a root password, so I don't have to log as root

Hi folks, I'm trying to install a program, and I want to place some of the executables into /usr/bin so that they can be executed from any folder on the computer. I've been giveng the root password, but told never to log in directly as root. Instead, I can wait for a password prompt. However, I... (2 Replies)
Discussion started by: lunchtime
2 Replies

10. Shell Programming and Scripting

any way to use SU command without prompt for password

Hi, First i want to tell you i am not a administrator and everytime to run a sqlscritpt i have to login as SU in a particular account to connect to sqlplus.. I want to write a script which can make me free by doin this .. since i am having the permission for SU i want to know if i can SUDO... (7 Replies)
Discussion started by: myelvis
7 Replies
Login or Register to Ask a Question