Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
TRICK: su to root without a password
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
nesl247
Veteran
Veteran


Joined: 15 Jun 2004
Posts: 1614
Location: Florida

PostPosted: Mon Dec 26, 2005 4:26 pm    Post subject: Reply with quote

andyfaeglasgow wrote:
You can actually do this without using ssh or sudo by configuring pam.

Check out /etc/pam.d/su. If you uncomment one of the lines in there, wheel users can su to root without any password required. If someone is sitting on your machine as a wheel user you're in trouble anyway.


Thats what my post was about...
Back to top
View user's profile Send private message
humbletech99
Veteran
Veteran


Joined: 26 May 2005
Posts: 1229
Location: London

PostPosted: Mon Dec 26, 2005 11:09 pm    Post subject: Reply with quote

yeah, I'm aware of how cool pams are but they're also quite complicated to first look at and if you don't get them exactly right you'll screw your system and you'd have to do a recovery, so if somebody isn't familiar it's best to leave them alone as they aren't worth the hassle.

generally it's easier to just put the line in sudoers to allow sudoing without a password and then sudo su without needing a passwd. you could create an alias in your bashrc script as follows su="sudo su" and then all will work as desired with transparent ease.

Still think it's better to just su and put in your passwd though...
Back to top
View user's profile Send private message
cornet
n00b
n00b


Joined: 11 Mar 2003
Posts: 12

PostPosted: Wed Dec 28, 2005 5:40 pm    Post subject: Reply with quote

humbletech99 wrote:

generally it's easier to just put the line in sudoers to allow sudoing without a password and then sudo su without needing a passwd. you could create an alias in your bashrc script as follows su="sudo su" and then all will work as desired with transparent ease.


Still a silly idea, definitly not for use on a production server.


humbletech99 wrote:

Still think it's better to just su and put in your passwd though...


Indeed - if you're unsure about anything said in this thread then just stick with passwords.

Cornet
Back to top
View user's profile Send private message
humbletech99
Veteran
Veteran


Joined: 26 May 2005
Posts: 1229
Location: London

PostPosted: Wed Dec 28, 2005 11:11 pm    Post subject: Reply with quote

Indeed, I prefer to stick with passwords, they're not that much trouble and any seasoned sysadmin will be more than used to putting them in all the time...

Su and use a password. Simplest, safest and most elegant solution.
Back to top
View user's profile Send private message
pyxel
n00b
n00b


Joined: 04 Nov 2005
Posts: 44
Location: Bratislava/brussels

PostPosted: Fri Feb 10, 2006 7:20 pm    Post subject: Reply with quote

my mean:

Code:
# cat /etc/sudoers
...
root    ALL=(ALL) ALL
pyxel ALL=(ALL) NOPASSWD: ALL
...


Code:

# cat /home/pyxel/.bashrc
...
alias su='sudo su'
...


and just type su for root login.
Back to top
View user's profile Send private message
ectospasm
l33t
l33t


Joined: 19 Feb 2003
Posts: 711
Location: Mobile, AL, USA

PostPosted: Fri Feb 10, 2006 10:05 pm    Post subject: Reply with quote

pyxel wrote:
my mean:

Code:
# cat /etc/sudoers
...
root    ALL=(ALL) ALL
pyxel ALL=(ALL) NOPASSWD: ALL
...


Code:

# cat /home/pyxel/.bashrc
...
alias su='sudo su'
...


and just type su for root login.


That's what I eventually ended up doing (except my alias is "sup", just for the sake of making it distinct). The only thing I miss from the ssh method is the notice I'd receive of my last login when I'd login, and I'm too lazy to figure out how to put it in .bashrc...
_________________
Join the adopt an unanswered post initiative today
Join the EFF!
Join the Drug Policy Alliance!
Back to top
View user's profile Send private message
Xk2c
Apprentice
Apprentice


Joined: 17 Jul 2004
Posts: 240

PostPosted: Fri Feb 17, 2006 11:16 pm    Post subject: Reply with quote

Code:
alias su='sudo su'

Quote:
and just type su for root login.


instead of using this alias you could also just type:
Code:
 sudo -i

_________________
useful Xterm, Aterm and RXVT-Unicode features
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum