Tag Info

Hot answers tagged

7

The way to add a directory to sudo's PATH (which, as you found out is not the same as root's), is to edit the sudoers file: sudo visudo Then, find this line: Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" And add your directory to the end of it: Defaults ...


3

The reason this is failing is that, by default, ssh does not create a terminal (a pty) on the target machine. This means that su cannot prompt for a password, so it fails. (sudo would also fail to prompt, for the same reason, unless given the -S flag - as pointed out by @Scott.) You can tell ssh to create a terminal (pty) on the remote system, so that su ...


3

Just add all needed commands to sudoers separately: %webteam cms051=/usr/bin/systemctl restart httpd.service %webteam cms051=/usr/bin/systemctl stop httpd.service %webteam cms051=/usr/bin/systemctl start httpd.service %webteam cms051=/usr/bin/systemctl status httpd.service


2

By default on enterprise GNU/Linux and it's derivatives, the adduser command creates a user which is disabled until you explicitly specify a password for that user. Here is an example on CentOS 6.5, which should be the same as Scientific Linux. $ sudo adduser test $ sudo grep test /etc/shadow test:!!:123456:0:99999:7::: the reason for this is because ...


2

It's safest to itemize them as jofel suggests. If I wanted to allow someone to use a limited subset of a command's abilities, I would not trust wildcards in a sudoers line to do it. Even if the language was more expressive than shell globs, there are just too many corner cases to keep track of. The "service httpd *" line is relatively safe because (verify ...


2

dd if=boot1h of="/dev/r$temp1" status=none The status= flag controls which info to suppress outputting to stderr; 'noxfer' suppresses transfer stats, 'none' suppresses all dd (coreutils) 8.21


2

RESTRICT The way I interpret "restricting users to the set of programs that do not [allow shell escapes] is often unworkable", it means that it is so common for programs that, on the surface, seem to perform a single, safe task, but actually allow one to run any other program, that one should assume, in the general case, that giving a user access to a ...


1

Ultimately, Debian's (and therefore Ubuntu's) adduser calls gpasswd: my $gpasswd = &which('gpasswd'); &systemcall($gpasswd, '-a',$existing_user,$existing_group); Debian's adduser was written with the purpose of being a convenient frontend to a range of utilities (it makes use of, at one step or another, useradd, gpasswd, ...


1

gksu acts like su, not sudo. That's why it asks you root password. Try to run gksudo instead if available. If not, you can run gksu --sudo-mode. Also, from the man page: Also notice that the library will decide if it should use su or sudo as backend using the /apps/gksu/sudo-mode gconf key, if you call the gksu command. You can force the backend by ...


1

I asked the same question in sudo mailing list, and the answer: Currently you can only set the real and effective gids. There is no way to set the group vector.


1

I see you've tagged your question osx so if you've done this on a mac, make use of the GUI. Open any Finder window and press cmd shift G Type /etc/sudoers and press return to go to the file Press cmd i with the file highlighted Scroll to the bottom of that info window to 'Sharing & Permissions` and click the lock icon in the bottom right Type an admin ...


1

.bashrc is executed only by interactive shells, not by scripts┬╣. It's the wrong place to define environment variables. See Alternative to .bashrc and the Ubuntu wiki. You can tell bash to read .bashrc explicitly. Of course you'll have to execute bash, not sh which could be a different shell: sudo -i -u username bash -c '. `~/.bashrc; echo "$MY_ENV"' But ...


1

In addition to /etc/sudoers, sudo will also read files in the /etc/sudoers.d directory. The cloud-init application, commonly used on AWS instances, places a sudoers configuration in that directory for allowing the default user to sudo without a password.



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