LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   su and sudo don't say what password to enter (https://www.linuxquestions.org/questions/linux-software-2/su-and-sudo-dont-say-what-password-to-enter-862079/)

MTK358 02-11-2011 11:37 AM

su and sudo don't say what password to enter
 
I wonder how to make su and sudo say what user's password to enter?

It's not a big problem for me because I have the same password for both my normal account and the root account, but still it would be nice.

reed9 02-11-2011 11:49 AM

I don't really understand the problem. Su is by default going to be the root password, unless you're specifying a specific user, and sudo is going to be the current user's password.

Reuti 02-11-2011 11:52 AM

For sudo is specifying whose password I have to enter:
Code:

$ sudo -u oleg ls
oleg's password:


David the H. 02-11-2011 11:55 AM

su means "switch user". So you will enter the password of the user you are switching to, which is root by default.

sudo is "superuser do" (or at least that's the usual translation). It's a system for giving regular users access to commands they wouldn't normally be able to use. Since you have been given permission by the administrator to issue the command, you use your own password.

MTK358 02-11-2011 12:19 PM

Quote:

Originally Posted by David the H. (Post 4255343)
su means "switch user". So you will enter the password of the user you are switching to, which is root by default.

sudo is "superuser do" (or at least that's the usual translation). It's a system for giving regular users access to commands they wouldn't normally be able to use. Since you have been given permission by the administrator to issue the command, you use your own password.

I know that.

But in distros like Ubuntu it actually asks "Password for <user>:" instead of just "Password:", and I was curious about how to do that.

And it can have a useful purpose, for example if a script asks for a password, you don't know if the script is using su or sudo, thus you don't know whether to enter your or root's password.

corp769 02-11-2011 01:33 PM

Are you talking about a script that you made yourself?

David the H. 02-11-2011 01:44 PM

Heh, I didn't notice who I was replying to. Of course you're experienced enough to know that. But it wasn't clear enough in your original request what you want.

I see that sudo has a -p option for formatting the password prompt. (edit: and a SUDO_PROMPT env. variable) I don't see anything similar for su.

acid_kewpie 02-11-2011 01:47 PM

Well Sudo has options for changing the prompt if you read the manpage *ahem*, not sure why it matters though. A script is, obviously, a script, you can just echo out whatever the hell you want to when you want to, no need to care about the subtleties of the commands you're running. If the script doesn't make it obvious, it's a pretty poor script in the first place. Unless it's within an evironment, e.g. ubuntu, where it is implicit.


All times are GMT -5. The time now is 09:17 AM.