Tag Info

Hot answers tagged

11

First of all, you should probably consider why this isn't working in the first place. If you don't understand why they are owned as different users there is a good chance that you will be breaking something by attempting to hack around the limitation. It is quite likely that there is a security issue you will be opening yourself up to by doing this. ...


9

Do not do that! That will leave your password in your shell's history! If you really have to do that, what I recommend is that you configure your sudoers file to allow a passwordless login. To do that, run the command sudo visudo and add a line like this one: reddy ALL=NOPASSWD: /bin/su - * (where reddy would be your username). If you need to give this ...


8

The sudoers file allows specifying commands to permit: username ALL=(root) NOPASSWD: /bin/foo bar baz Here username is the user you want to permit, and the command goes at the end of the line. If you specify arguments to the command, the user can only run it with exactly those arguments, but if you don't specify them here, the user can run the command ...


5

No you're unable to find out whom has access to sudo rights if you yourself do not have access directly. You could possibly "back into it" by seeing what users if any are members of the Unix group "wheel". Example This shows that user "saml" is a member of the wheel group. $ getent group wheel wheel:x:10:saml Being a member of the "wheel" group ...


5

I agree with Valmiky that you're going about it the wrong way, but the sudoers line there isn't what I'd recommend. With his line, you are all authorized to sudo to anybody else including root without password. This effectively gives you full access to the server, meaning that the /bin/su part of the line is redundant. If you should only be able to sudo to ...


4

Try: #!/bin/bash id touch script-run-user.file sudo -u appuser 'ksh' <<EOF # add list of cmds to execute id touch appuser.file EOF Edit: Just as an update, check out Here Documents. EOF = "End Of File", the name is arbitrary.


3

That's how sudo works. You trust the user and the user's actions are logged. If you want to enter the root password, then you want to use the su command as follows:- su -c yum install <package> Password: Once the command above finishes, you're returned to your normal user's prompt.


3

This is what worked for me: USER_NAME=$(printf '%s' "${SUDO_USER:-$USER}") sudo -u $USER_NAME <command-to-exec-in-nonroot-context>


3

I don't think this is possible because sudo will not know that a user doesn't have a password or that it's the empty string until it (sudo) presents the password, empty or otherwise, to the PAM module for validation. Therefore it will always need to request the password from the user, before proceeding. Your only recourse here is to configure users that do ...


3

You can use suspend (as long as you invoked the shell with sudo -s instead of sudo -i): anthony@Haruhi:~$ sudo -s [sudo] password for anthony: root@Haruhi:~# suspend [1]+ Stopped sudo -s anthony@Haruhi:~$ If you invoked it with sudo -i, you can use suspend -f to force it to suspend anyway; note that you need to be careful there (as if ...


2

sudo From the relevant man page: The real and effective uid and gid are set to match those of the target user as specified in the passwd file. Also, in the description for the -P (preserve group vector) option to sudo: The real and effective group IDs, however, are still set to match the target user. Basically, whatever commands that are run ...


2

Use sudo -E, which will export your environment.


2

You should configure sudo security policy to allow user xyz exec something as user abc. Read 'man sudoers' and use visudo command to configure /etc/sudoers. For example let's allow user xyz exec /usr/bin/whoami as user abc without password. Add this string into /etc/sudoers (with visudo, don't edit /etc/sudoers directly): xyz ALL = (abc) NOPASSWD: ...


2

This is because sudo is different from su. When you su abc, you become the user abc as far as the system is concerned. You can then do anything that abc can do. On the other hand, sudo is used to allow other users to execute some commands by proxy. In other words, your sudo configuration allows you to do some commands on behalf of abc. If the command you're ...


2

Use sudo -E to preserve your environment: $ export FOO=1 $ sudo -E env | grep FOO FOO=1 That will preserve $HOME and any other environment variables you had, so the same configuration files you started with will be accessed by the programs running as root. You can update sudoers to disable the env_reset setting, which clears out all environment variables ...


2

You can run this command via sudo on the server to capture the data first, and then send the resulting file back to your workstation to review the data sudo tcpdump -i eth0 -s 65535 -w /tmp/wireshark


1

sudo -s Reads the $SHELL variable and executes the content. If $SHELL contains /bin/bash it invokes sudo /bin/bash. So, /bin/bash is started as non-login shell so all the dot-files are not executed, but bash itself reads .bashrc of the calling user. Your environment stays the same. Your home will not be root's home. So you are root, but in the environment ...


1

Without sudo the command doesn't have privileges to capture the device: tcpdump: eth0: You don't have permission to capture on that device But with sudo it would, but having been run after ssh, it never gets password input for sudo on the remote server, so the solution is use -S (man sudo) and pipe password for sudo as follows: ssh john@server-abc.com ...


1

Set up sudo to preserve the HOME environment variable. Run visudo to edit the sudo configuration. Make sure that the option always_set_home is not set, and that HOME is present in the env_keep list. Add the following lines: Defaults !always_set_home Defaults env_keep+="HOME" Remove a line like Defaults always_set_home if there is one.


1

Line 1: Mounts Types: NetworkFileSystem, SambaFileSystems, and CommonInternetFileSystems on All Shared Paths to the Users Home Directory, Along with: Mount All Devices as a loop, Along with Unmounting, all Saved in the Array MOUNTING. Line 2: Prints the kernel dump from the last successful boot, saved in the Array SYSTEMDIAG. Line 3: If the User is logged ...


1

As the other answerers said, this is the default behavior. If you really want to enter the root password instead of the user's password, you can add the line Defaults rootpw to your /etc/sudoers file (use the visudo command, do not edit the sudoers file by any other means). The usual disclaimer: The defaults chosen for sudo are the way they are for a ...


1

Well it is how it's done. You will grant the permission to users of group wheel to perform administration duties. In short you grant them root access. And this is not distro specific - in all Linux distributions and even BSDs you will do the same. If you're worried about compromising security you could remove the user from sudoers table and go with root. ...


1

From: http://www.sudo.ws/sudoers.man.html username ALL=(ALL:ALL) /some/random/command should allow username to run /some/random/command as any other user (including root) from any host. No one but username would be able to run that command if that is the only rule in the file. Make sure there's not another rule that says "user" or "group" can run ...



Only top voted, non community-wiki answers of a minimum length are eligible