Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Normal user execute command as root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dfsr
n00b
n00b


Joined: 17 Jun 2015
Posts: 14

PostPosted: Fri Sep 04, 2015 12:29 am    Post subject: Normal user execute command as root Reply with quote

Hi,
When I su -, it is root.
Whether a normal user ececute command as the root?

Thank you.
Back to top
View user's profile Send private message
djdunn
l33t
l33t


Joined: 26 Dec 2004
Posts: 810

PostPosted: Fri Sep 04, 2015 1:40 am    Post subject: Reply with quote

su aka switch user is the command you use to change your user to root, you could use su username to change to any other username on your system.

about your question if i understand correctly you may be thinking of sudo, which is a command that allows a normal user to execute specific commands with root privileges, its widely considered a security risk to allow a user to access any all commands with sudo. A good rule is that sudo should not be used by anyone with knowledge of the root password.
_________________
“Music is a moral law. It gives a soul to the Universe, wings to the mind, flight to the imagination, a charm to sadness, gaiety and life to everything. It is the essence of order, and leads to all that is good and just and beautiful.”

― Plato
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Fri Sep 04, 2015 2:04 am    Post subject: Reply with quote

djdunn wrote:
A good rule is that sudo should not be used by anyone with knowledge of the root password.


But sudo asks you for the password, hence sudo should not be used at all and hence administration of an Ubuntu system is impossible.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Fri Sep 04, 2015 2:53 am    Post subject: Reply with quote

Ubuntu root previlege restriction using sudo can be bypass easily by
Code:
sudo passwd root

Than any user with sudo capability can change the root password and open a complete root session.
_________________
Paul
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Fri Sep 04, 2015 10:31 am    Post subject: Reply with quote

You can open root shell by sudo -s if you have unrestricted right to sudo. sudo -i will give you root rights even if root account is disabled.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3135

PostPosted: Fri Sep 04, 2015 1:44 pm    Post subject: Reply with quote

Tony0945 wrote:
But sudo asks you for the password, hence sudo should not be used at all and hence administration of an Ubuntu system is impossible.

For _user's_ password, not root's one.
And you can restrict it with /ets/sudoers to only allow some users to execute only some particular commands (with or without password)
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Fri Sep 04, 2015 1:58 pm    Post subject: Reply with quote

szatox wrote:
Tony0945 wrote:
But sudo asks you for the password, hence sudo should not be used at all and hence administration of an Ubuntu system is impossible.

For _user's_ password, not root's one.
And you can restrict it with /ets/sudoers to only allow some users to execute only some particular commands (with or without password)


I don't think so, what's the point? the user is already logged in and obviously knows his own password. I just experimented but I can't tell who is right by my system. Root su's without a password and my /etc/sudoers is set to allow user 'tony' to su without a password. From my experiments other users can't su at all. I like it that way.
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Fri Sep 04, 2015 2:05 pm    Post subject: Reply with quote

Tony0945 wrote:
szatox wrote:
Tony0945 wrote:
But sudo asks you for the password, hence sudo should not be used at all and hence administration of an Ubuntu system is impossible.

For _user's_ password, not root's one.
And you can restrict it with /ets/sudoers to only allow some users to execute only some particular commands (with or without password)


I don't think so, what's the point? the user is already logged in and obviously knows his own password. I just experimented but I can't tell who is right by my system. Root su's without a password and my /etc/sudoers is set to allow user 'tony' to su without a password. From my experiments other users can't su at all. I like it that way.


You are mixing it all up. su and sudo are completely different things.

su [user] changes the user, defaults to root, you need to be in wheel group for su root, you need to give root password to su root.
sudo gives fine grained control over who can do what, you give your user password - and it makes sense, if you leave your computer and somebody else is using it with your user logged in they cannot gain rights they are not allowed to.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sun Sep 06, 2015 8:17 am    Post subject: Reply with quote

Hooray for visudo ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
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