Hi;
I need a command in terminal to use sudo and the root password in a single line!
In general we enter sudo and then terminal prompt us to insert pass but i wanna to insert sudo and pass in one step!
Is it possible?
J.S
Be free...
Hi;
I need a command in terminal to use sudo and the root password in a single line!
In general we enter sudo and then terminal prompt us to insert pass but i wanna to insert sudo and pass in one step!
Is it possible?
J.S
Be free...
You can set specific programs to not need passwords in sudo, but you have to be careful in setting it up.
Here is one example:
It allows anyone in the group adm to adjust the interface eth0.Code:%adm ALL=(ALL) NOPASSWD: /sbin/ifconfig eth0 *
For one time you can do
The apt-get update command is an example here, you can replace it with yours.Code:echo "password here" | sudo -S apt-get update && history -c
The passwd file contains your password and because of it is dangerous to have your password in a text file, the last command rm passwd will remove this text file at the end.
The history -c will remove all the bash shell's history , where your password is exposed.
Regards
NikTh
Last edited by NikTh; June 18th, 2013 at 04:38 PM. Reason: edited the command due to Lars Nooden's comment
thx NikTh for your help...
have good times
Last edited by shirani; June 18th, 2013 at 04:30 PM. Reason: don't see new post
That could be boiled down even shorter, skipping the redirect to a file and just piping the echo into sudo. However, either way you end up with the password unencryped in the shell's history which is a very big risk. If you do either way, the history should be cleared immediately, history -c but if you are using another shell than bash, the method might be different. I'd advise against anything that puts the password in cleartext.
Thanks Lars and NikTh...
Have good times....
Please mark the thread as solved. See my signature for a How To.
Regards
NikTh
Bookmarks