Tag Info

New answers tagged

2

In short, it's a security thing. You have said, that mary can run certain commands without the supplying of a password. That fails, then the "default action" is taken. Go and ask the password, then log the failed attempt. With out getting horridly technical, it's the separation between authentication and authorization. is this mary trying to run a ...


0

You can download the git source and do ./configure --prefix=/home/user/myroot && make && make install to install git to your home directory provided you have the build tools. If you don't have the build-essential package installed (dpkg --list|grep build-essential), you will need to install those to your home directory as well. Copied from ...


1

Both programs are suid root. There is no reason to ever type "sudo su" except for the situation where one is unfamiliar with the "-i" and "-E" options to sudo, or otherwise in the habit of doing things as root without understanding why they're done. The su commands passes through a few hard-coded environment vars, while sudo can control exactly which ones ...


0

sudo su, sudo -i and all other sudo requires the users password. su requires the root password.


1

If you can use simply su, you should. But, in most modern (desktop-) Linux distributions (for example Ubuntu) the root user is disabled and has no password set. Therefore you cannot switch to the root user with su (you can try). You have to call sudo with root privileges: sudo su.


0

On some systems, su to root is not enabled for normal users, so sudo su is required.


2

Traditionally, interactive password problems are solved by using the expect command which creates an intermediary pseudo-tty to talk to the process. Here's an alternative python version using the equivalent python-pexpect package. Create a python file run.py: import sys,pexpect (pw,cmd) = sys.argv[1:] child = pexpect.spawn(cmd) ...


0

I got this error on every exit. I did not use sudo. It explicitly mentioned my user home directory: E138: Can't write viminfo file /Users/henrik/.viminfo! Removing ~/.viminfo did not fix the error. Turns out I had a bunch of viminfo temp files, and removing those fixed the issue: ls ~/.viminf* # If you want to see the files. rm -rf ~/.viminf* # ...


3

su and sudo are the two most common ways to run a program (possibly a shell) as another user (possibly root). They have the same effect, but they work very differently in terms of how they determine whether to allow the action: su requires that either the source user is root, or the user demonstrate that they have access to the target account (typically by ...


1

Sudo is an additional program which may or may not be installed on a system. It's available as package sudo on Debian. Without more information on the specific situation/code you are referring to, the most likely answer is that sudo cannot be assumed to be installed, why su is required to be present as by the POSIX standard installed as part of Debians base ...


0

Your existing login session didn't load with the wheel group membership. Now that it's been granted, you can incorporate it by entering: newgrp wheel ... without having to log out or reboot.


2

Group changes on unix are not recognized by existing login sessions; assuming, say, a Linux system with the usermod command: $ groups user $ sudo usermod -G wheel $USER ... $ grep user /etc/group | grep wheel wheel:x:10:user $ groups user To see the group change, any existing sessions (e.g. SSH, X11, etc.) must be exited, and a new session made (e.g. open ...


8

You can reenable aliases as described at http://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo the short version is to add and alias for sudo as alias sudo='sudo ' to get it to check the rest of the command for aliases. Otherwise, the sudo is check to see if it's an alias, it is not, so the rest of the alias checking ends. If sudo ...


3

You seem pretty close with your PAM conf line: session [success=1 default=ignore] pam_succeed_if.so service in sudo quiet uid = 0 Looking at the manual page for pam_succeed_if, I think you want to test that the requesting user (ruser) is zabbix. So I suggest: session [success=1 default=ignore] pam_succeed_if.so quiet uid = 0 ruser = zabbix That will ...


0

Seems this was already asked and answered here: http://stackoverflow.com/questions/14277116/suppress-log-entry-for-single-sudo-commands, copied below with the user changed to "zabbix": You can disable the logging on a user basis using the Defaults: directive > Defaults:zabbix !syslog or using a Cmnd_Alias to disable it per command(s) > ...


2

You seem to have some editing errors in your post. There is a "&" missing for the sudo line, and you are using different names for your pipes later in the script. Here is something that works for me: #!/usr/bin/env bash mkfifo pipein mkfifo pipeout echo '/usr/lib/openssh/sftp-server <pipein >pipeout' | sudo su anotheruser & cat <pipeout ...


0

I'm not sure I understand your question completely but I think you are after something like this: sudo -u $USER sh -c "ls -la /home" | grep $USER Or if you want the pipe as the other user sudo -u $USER sh -c "ls -la /home | grep $USER"


3

Set the history file to ~root/.bash_history.$SUDO_USER, where $SUDO_USER is automatically set to the user who invoked sudo. For example, the following could go in your root bashrc: HISTFILE="$HOME/.bash_history.$SUDO_USER"


1

See my Detailed Solution Here. Your solution will be much the same. What you'll want to do differently is use multiple Cmnd_Alias's to make debugging, and adding new commands easier. You can use these multiple alias strings, in conjunction with the Negate Operator, as DarkHeart pointed out in his answer.


2

You can exclude command with sudoers. Eg: Cmnd_Alias DEV_EXCEPTIONS=/bin/su, /usr/bin/vi %devgrp ALL = ALL, !DEV_EXCEPTIONS Results in User XYZ may run the following commands on this host: (root) ALL, (root) !/bin/su, !/usr/bin/vi The user will still be able to run the su command


3

It's a bug in xonsh. In the build_ins.py module, xonsh attempts to determine if a file is "binary" or not by opening it and reading a few bytes: def _is_binary(fname, limit=80): with open(fname, 'rb') as f: for i in range(limit): char = f.read(1) if char == b'\0': return True if ...


1

The full specification of the sudoers syntax is more complex than you've listed. The host specification just tells sudo on which hosts that user is allowed to run those commands. If the host specification is "ALL", which the man page says: The reserved word ALL is a built-in alias that always causes a match to succeed. It can be used wherever one might ...


2

2nd ALL= on all hosts (if you distribute the same sudoers file to many computers)


0

I encountered the same issue, it seems like the environment is preserved when switching users this way. This causes the wrong git config to be loaded, which fails due to permission problems. In my case I circumvented the problem by using the following command sudo -u deploydeputy /bin/bash -c "export HOME=/home/deploydeputy && git clone ...


1

Yes, monit either needs to run sudo, or to be running as the root user. Configuring monit as its own user with the correct permissions is also viable however it is probably the most involved of the potential solutions. Generally running sudo from scripts is not viable as it will prompt for a password. It is possible to stop sudo prompting for a password in ...


1

Solution Create a new Group: groupadd -r updaters The -r option reserves a system group, i.e. 0 - 100. Add Users to Above Group: useradd -G updaters john, useradd -G updaters sally. You can also use the user alias section to acheive this. See Sudoer File Examples for a fully functioning User Alias Section. In my opinion, doing it the way I've done ...


-2

No. If logging is enabled for sudo, sudo -i FOO logs FOO (thus leaving an audit trace) while sudo su; FOO will only log the su but not the commands that follow it (like FOO). And of course the main difference is the use of passwords: sudo -i needs only the password of the user (if sudo is configured that way) while sudo su needs the password of root.



Top 50 recent answers are included