Tag Info

Hot answers tagged

8

Can the "foouser" escape to root prompt? Presumably foouser can now open any system binary and "edit" it into something else completely, leaving whatever kind of security hole foouser can dream up. This has particular potential if you do it to a setuid binary, such as passwd, because it means a non-root user could use it do privileged things it was not ...


8

source is a shell builtin, so it cannot be executed without the shell. However, by default, sudo do not run shell. From sudo Process model When sudo runs a command, it calls fork(2), sets up the execution environment as described above, and calls the execve system call in the child process If you want to explicitly execute shell, use -s option: # ...


5

Pro tip: There is never really a good reason to run sudo su. To run a command as a different user, use sudo -u username command. If you want a root shell, run sudo -i or sudo -l. If you have activated the root account, you can also run su alone, but sudo su is just not useful. And yes, I know you see it everywhere. That said, sudo has the -E switch which ...


4

From the sudoers(5) man page: The sudoers policy plugin determines a user's sudo privileges. For the targetpw: sudo will prompt for the password of the user specified by the -u option (defaults to root) instead of the password of the invoking user when running a command or editing a file. sudo(8) allows you to execute commands as someone else ...


4

The built-in delay is to slow down the process of password guessing. Looks like someone could programmatically guess about 27 potential passwords per minute, which, as you've observed is a good deal less than if there was no delay.


4

The environment variable expansion is done by the shell so the command you're actually running is "sudo echo tim". This is all done before sudo is run.


3

You can do it without calling login shell: sudo DUMMY=dummy su ec2-user -c 'echo "$DUMMY"' or: sudo DUMMY=dummy su -p - ec2-user -c 'echo "$DUMMY"' -p option make sudo preserve environment variables.


3

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

There is an incredible amount of files that one can modify to "install a backdoor" on the system (editing /etc/group is the easiest, but there are lots of more stealthy way to achieve it). It is also possible to disable this noexec protection by editing /etc/sudoers file! I wouldn't rely on NOEXEC to make "sudo $editor" secure. it is not secure. DO use ...


2

In the realm of solving the problem rather than answering the question, here's the most obvious (to me) way to source a file which only root can read: source <(sudo cat /etc/environment) This uses process substitution. It takes the output of the cat command and turns it into a pseudo-file, which you can pass to source. source then runs the commands ...


2

sudo expects a command but you are giving a shell builtin so it cannot find the command. If you write type source, you can see the output: source is a shell builtin and the output of which source is empty. For example sudo strace will work and which strace will give output because strace is a command. Edit: Also, you can see sudo su;sudo source ...


1

If the instance doesn't contain anything important, I'd suggest chalking this up as a learning experience and blowing it away and starting over. If you must fix it, you could shut down the instance, saving the disk image, and mount it on another instance and fix the permissions.


1

Yeah - that is a "gotcha" for sure. Use visudo in the future to avoid that problem. I have a CentOS 7 VM, which is essentially the same as RHEL7; and I was able to use su - to become root without using sudo, because I know the root password. Do you know your password for the user, root?


1

If you follow the next link on the documentation page: http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-pam-timestamp-remove.html you can find a reference to the pam_timestamp_check utility. The pam_timestamp_check utility will check the validity of the file and the return value can be checked. See also man pam_timestamp_check for details. On my ...


1

The variable expansion is performed by your interactive shell. You're running the command sudo with the arguments echo and tim. If you want the expansion to happen in the shell invoked by sudo, tell it to run a shell and pass the string echo $ME to that shell: sudo sh -c 'echo $ME' sudo removes most variables from the environment, because they can be a ...


1

Wildcards with sudo commands are a bit dicey. They can appear to give you security without actually doing so. To sudo, the * does not mean "any files under this directory" as it does in the shell. Rather, it means "any additional options" and must stand alone. Unfortunatley, you cannot in sudo restrict part of the arguments, and further, it wouldn't be ...


1

Depending on what files you want, you can create a new group (/etc/group) and make the file writable (and the directory containing it if you want the user to create new files) by that group (e.g., chgrp <groupname> <file>; chmod g+w <file>


1

For each of the urls mentioned in the error message in the question, do a search for it. Then remove it from the relevant file in /etc/apt/sources.list.. For example cd /etc/apt/sources.list.d grep -R http://old-releases.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages This will give you a name of a file in /etc/apt/sources.list.d. Then go into ...


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 ...



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