LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-09-2007, 02:43 PM   #1
themanwhowas
Member
 
Registered: Nov 2005
Distribution: CentOS 5, Fedora 23
Posts: 218

Rep: Reputation: 29
add su password


hi guys.

Is there a way to add the password to an su command? i mean instead of it asking for the password is there a switch or something that i can use like su -p password

I'm experimenting with bash and i cant find any way around this. The best i have is su -c 'yum update' which asks for the password then runs the yum update command automatically.

Thanks
 
Old 09-09-2007, 02:45 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
But that'll mean putting your root password in plaintext. Also, if the program needs to run on a PC that isn't your own, the password will be incorrect.

Either way, you are introducing a massive security hole.
 
Old 09-10-2007, 11:04 AM   #3
themanwhowas
Member
 
Registered: Nov 2005
Distribution: CentOS 5, Fedora 23
Posts: 218

Original Poster
Rep: Reputation: 29
its a home pc. im the only person who uses it. never going to distribute the file to anybody. Its safe.

Lets imagine that i just want to su with a password without a bash script just using a normal konsole.

Is it possible?
 
Old 09-10-2007, 11:09 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
It would be better to use sudo. You can set up sudo (using the visudo program) so that if you are a member of the %wheel group you don't need a password. There is a sample line for this that you just need to uncomment. However, this isn't the most secure either. Remember, if you are connected to the internet, you still have to be careful about security.
 
Old 09-10-2007, 11:19 AM   #5
themanwhowas
Member
 
Registered: Nov 2005
Distribution: CentOS 5, Fedora 23
Posts: 218

Original Poster
Rep: Reputation: 29
sudo eh? i'll look into it. thanks
 
Old 09-10-2007, 05:09 PM   #6
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
I checked the man page for su, there appears to be no option to pipe the command to it, you'd need to build it into the script. Sudo is definitely the better way to go.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add an user, without password?? cenzole Linux - Newbie 22 12-25-2017 06:05 PM
add a user with password without prompt grendel-IT Linux - Software 7 09-27-2006 02:07 PM
Add New User with Password canuck_barlow Linux - Newbie 1 09-25-2006 02:41 AM
add user prompt for password on login redir Linux - Newbie 2 02-28-2005 11:01 AM
How to Add Password for Resuming from Suspend (Using apmsleep) Ian Linux - Hardware 0 05-03-2004 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration