Tag Info

Hot answers tagged

6

This is a choice. If you don't like it, you can use the -i or -H option, or change the configuration. The sudo(8) man page says for HOME: Set to the home directory of the target user if -i or -H are specified, env_reset or always_set_home are set in sudoers, or when the -s option is specified and set_home is set in sudoers. Actually env_reset doesn't ...


5

The point of a “graphical sudo” is to prompt for the user's password. If you don't want a password prompt, use plain sudo. Run visudo to create an entry in the sudoers file with the NOPASSWD tag. Note that this entry must come after any ALL entry. Make sure that the DISPLAY and XAUTHORITY environment variables are preserved, to allow running X11 ...


4

When a user invokes sudo -l it lists what sudo will allow them to do, so you could have a script ran as root that bumps through /etc/passwd and sudo's to each user, invoke the sudo -l, directing the output to /tmp/${USER}_sudo_i_can_do.txt But if you don't have root access, you won't be able to do what you want to do; the list of permissions is readable ...


4

Test if you are root, and if not, restart with sudo, for example: #! /bin/bash if [[ $EUID -ne 0 ]]; then exec sudo /bin/bash "$0" "$@" fi


3

The parent (sudo) is notified that the child process has exited. As the only purpose of the parent was to run this child process it terminates. Other processes would not terminate just because you kill a child process. On the other hand the child doesn't care what the parent process does. The parent could even terminate immediately after the child process ...


3

What you are looking for is sudo -v. From the man page: -v, --validate Update the user's cached credentials, authenticating the user if necessary. (And the counterpart to explicitly remove the credentials: sudo -k)


3

Try: Defaults timestamp_timeout=0 An example from man 5 sudoers, where a value is appended to an option: Defaults env_keep += "DISPLAY HOME"


3

traceroute need not run as root; it just needs the capability CAP_NET_ADMIN. Thus you can set this as file capability for the file and then traceroute will always have this capability (for all users, though), if your kernel supports file capabilities and no Linux Security Module (SELinux, AppArmor) is blocking it: setcap CAP_NET_ADMIN+ep ...


3

sudo command requires password of current user, not root user. If you wish to authorize by root password you can just use su -.


3

Allowing LD_LIBRARY_PATH for suid binaries like sudo is a security problem, thus LD_LIBRARY_PATH gets stripped out of the environment. sudo by default doesn't passthrough LD_LIBRARY_PATH to its children either for the same security concerns: carefully crafted libraries would allow you to bypass the sudo argument restrictions to execute whatever you want. If ...


3

Try comparing the environments: $ sudo -s # diff <(su username -c env) <(sudo -u username bash -c env) For example, the environment for sudo is controlled by env_* defaults in /etc/sudoers.


2

That'll be because the PATH is different when running with sudo. Try comparing: which pip env vs. sudo which pip sudo env One secure workaround is to create a symbolic link to pip in /usr/local/bin or even /usr/bin. If you install pip using a package manager it will do this automatically on several (most?) distros.


2

Login by root it's not a good practice. You can configure your system to login with ssh-keys. And also disable login using password. Look at this post And if you have root privileges you can change root password. Use this commands: $ sudo -s # passwd root


2

If you want to be allowed to run commands as root, but be prompted to enter your own password, then edit the sudo configuration by running the visudo program. This brings up your favorite text editor to edit the sudo configuration file. Look for the line that authorizes you to run commands as root and remove the text NOPASSWD: from that line. Save the file ...


2

You can specify a transition in a custom policy file (.te) like this: module collectdlocalexec 1.0; require { type collectd_t; type user_home_t; type unconfined_t; type shell_exec_t; class capability {setgid setuid }; class file { execute read open }; class process transition; } allow collectd_t ...


2

In Linux, once a parent process is killed its child process becomes an orphan. But then the "warm hearted" init process adopts that orphan process which allows it to proceed. In order to kill parent and its children processes you can use: pkill -TERM -P <parent's PID> (Note: orphan process is different from zombie process, but that's for another ...


1

Yes, that's perfectly fine. A lot of common utilities do that. You should however have some fallback in case the application does not get sudo - but that's just good script writing. Another way to do things like these, that I do not recommend, is to ask the user to run the application as root, which is bad. So this alternative is better. Also make sure that ...


1

You can use SSH with X forwarding (-X) and a key without password. SSH has the useful feature that keys can be limited to one command. This could be a kind of sudo replacement: Prevent the user from doing as root what he wants; limit him to what he must be capable of doing.


1

I believe what you are trying to accomplish is making sure the user runs a script as root. To do this, you do not want to add it to the script, but instead just change the ownership of the file and the execute permissions. This can be done with: # chmod og-rx yourscript.sh # chown root:root yourscript.sh (by muru =]) or # chmod 750 yourscript.sh # ...


1

No Sudo Option You can use the source command to run another bash script in the same environment you came from. (Without launching a subprocess) Script1.sh #!/bin/bash read -p "Enter Your Full Name: " Name source script2.sh Script2.sh #!/bin/bash echo $Name -- With Sudo The reason your example doesn't work is because of the sudo. You can use Sudo ...


1

It only checks access when you issue a specific command: sudo. It doesn't check for just any command whether you have the right to run it with root privileges. The sudo elevates your privileges then runs the other commands as such, without needing any additional checks. Quite often the setup is such that you have to be member of the sudo group (e.g. ...


1

Add the following to your .bashrc: vim ~/.bashrc ... export LD_LIBRARY_PATH=/usr/local/lib This will let you restart your computer, and still have that path assigned.


1

This is too complicated for sudoers. You have to write a script which checks whether the user belongs to this group and calls passwd if so. sudoers must then be configured so that john can run this script as root. Of course, the path to this script must be writable only for root. #! /bin/bash group="groupname" test $# -ne 1 && exit 2 user="$1" ...


1

You can do this in single user mode. Restart system, at grub prompt press down or up arrow so grub screen will be pause. Press "e" to edit grub entries, Select the kernel line and again press "e" to edit mode Now add "1" or "single" at end of the line. and press enter. Press "b" to boot with this setting. Now fedora will start in single user mode. Now you ...


1

If you don't have root password, You have to boot with a Live-CD and chroot to your partition, find out to read only mounted or rw mounted with mount command. If read only mounted, use the following command: mount -o rw,remount / Then use : passwd root



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