LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Sudoer Help ........ (https://www.linuxquestions.org/questions/linux-general-1/sudoer-help-730838/)

jitendriya.dash 06-05-2009 02:31 AM

Sudoer Help ........
 
Hi,

When i use command "sudo -l" under my user, it gives me the following list.

(root) NOPASSWD: /bin/chgrp
(root) NOPASSWD: /bin/chmod
(root) NOPASSWD: /bin/chown
(root) NOPASSWD: /bin/mkdir
(root) NOPASSWD: /bin/su - hubsup
(root) NOPASSWD: /bin/su hubsup
(root) NOPASSWD: /bin/vi *.conf
(root) NOPASSWD: /bin/vi *.xml
(root) NOPASSWD: /usr/bin/find
(root) NOPASSWD: /usr/bin/passwd

(hubsup) NOPASSWD: ALL

Actually I am a bit confused for "/bin/su" command access.

For the lines with "/bin/su" , what does this mean exactly ? Does this mean that, I can do "\sudo su - hubsup" OR "\sudo su -l - hubsup" i.e. switching to hubsup user , which won't ask me for any password.

Actually, I tried with "\sudo su - hubsup" OR "\sudo su -l - hubsup" , from my user account, but, I was not able to switch to "hubsup" user.

with command, "\sudo /bin/su - hubsup" , i am getting blank output on the screen. Pressing enter key, is showing "WinSCP: this is end-of-file:0
" again and again. Then, I need to press ctrl+C to come out of the execution.

Can you please help me, in understanding, what is the meaning of "(root) NOPASSWD: /bin/su - hubsup" and how I can make use of "su" command, from my user-account here. (to switch to "hubsup" user)

Please help.

Thanks and Regards,

Jitendriya Dash.

Simon Bridge 06-05-2009 02:41 AM

Which distribution is this?

Note: when I run that command, the first line is:

User simon may run the following commands on this host:

... you do not mention this appearing for you. Does it?

Quote:

I tried with "\sudo su - hubsup" OR "\sudo su -l - hubsup" , from my user account, but, I was not able to switch to "hubsup" user.
What happened instead? Did you get an error message?

Why do you keep putting a backslash before the "sudo".

Quote:

how I can make use of "su" command, from my user-account here
sudo su hubsup

http://kb.iu.edu/data/amyi.html

Note - it is frowned upon to set up sudo without needing a password.

jitendriya.dash 06-05-2009 03:14 AM

Thanks a lot.. Further Inputs required...
 
Hi,

Thanks a lot, for your response. I am giving my outputs, with the following commands.

------------------------------------------------
PROMPT > /appl/local/bin/sudo /bin/su - hubsup

WinSCP: this is end-of-file:0

WinSCP: this is end-of-file:0

PROMPT > sudo /bin/su - hubsup
sudo: sorry, you are not allowed to preserve the environment

-------------------------------------------------

Even, when I am trying sudo su - $USER , it is not working, showing as, not authorized.

NOTE:-
with sudo -l , it is showing this line about user "hubsup".

---------------------------------
(root) NOPASSWD: /bin/su - hubsup
---------------------------------

So, my only concern is, this access is given in sudoer, but still I am not able to use su to user "hubsup".

Please share your views on the same.

Thanks and Regards,

Jitendriya Dash.

Simon Bridge 06-05-2009 05:02 AM

Quote:

WinSCP: this is end-of-file:0
You are accessing the terminal via some remote client?
Quote:

sudo: sorry, you are not allowed to preserve the environment
So do not try to preserve the environment.

The entry does not make much sence - if you want to executo a command as hubsup (hub supervisor?) when you are logged in as a regular (but sudo) user, then why not

sudo -u hubsup <command>

The sudo -l entry is telling me that your user can act as root, without password, when executing the command /bin/su - hubsup

... what is the sudoers entry for this?

Quote:

(root) NOPASSWD: /bin/su - hubsup
(root) NOPASSWD: /bin/su hubsup
I suspect that the subsequent entry has overridden the one you are trying to use.


All times are GMT -5. The time now is 03:56 AM.