Tag Info

New answers tagged

1

First restart the pc, press SHIFT key while Ubuntu is booting. This will bring you up the boot menu. Go to Advanced Options. Select your OS version in (recovery mode), and press Enter Key. example : Ubuntu 14.04 (recovery mode) It will bring you up another screen. Now select “Drop to root shell prompt” and press Enter. It will load a command line at ...


1

As the sudoers settings vary between OSes it is hard to predict what would work for you. sudo -EH the H switch tries to set $HOME to the target user's value, but this would not preserve $ZDOTDIR. Or add the line below to the end of sudoers using visudo. This tells sudo to keep the variables listed from the current environment. In this case you would then ...


1

The sudoers file is sensitive to the order of entries within it. The NOPASSWD entry must come after any other entries matching your user to take precedence. The rule is, "last match wins."


0

I've faced the same issue and I'm not allowed to run anything other than sudo su - devuser on dev server, so this is what I came up with: In devuser's .profile switch back to previous user home if found: prev_user_home=$(~/bin/home.sh) if [ -n $prev_user_home ] ; then cd $prev_user_home fi A script to determine a previous user. The script is ...


0

You would have to already have some sort of root level access, either via direct root passwd or your user id sudo rule setup prior to attempting to modify the sudoers file.


2

I'm pretty sure you just want sudo's little-k option, sudo -k vim ~/thefile which is documented to completely ignore your cachefile: When used in conjunction with a command or an option that may require a password, this option will cause sudo to ignore the user's cached credentials. As a result, sudo will prompt for a password (if one ...


2

There isn't an option to sudo that will do exactly what you want, but you can make a shell function that will create a new command sudok, which will run the sudo command and then have sudo remove its cached credentials. function sudok () { sudo "$@"; sudo -K; } Add that line to your ~/.bashrc or ~/.bash_profile to make it permanent.


0

sudo <command> 2>&1 /dev/null won't redirect anything to /dev/null. Instead, you are: Calling sudo with 2 parameters: <command> and /dev/null. The second one will be passed to <command> when it gets executed. Redirecting error messages to standard output. Here's a simple try: $ sudo ls 2>&1 /dev/null /dev/null See: you ...


0

See man sudoers; a timestamp_timeout setting is described there. Set it to 0 to make sudo always prompt for a password.


3

To determine what editor to run, sudo checks three environment variables (in order): SUDO_EDITOR, VISUAL, and EDITOR, and uses the first editor it finds. (If it doesn't find one, it falls back to a default.) So you can make it run vimdiff instead of vim as follows: $ VISUAL=vimdiff sudoedit file1 file2 If your sudoers policy only lets you edit certain ...


1

Here is a fiddly solution. Please feel free to optimise it! Perhaps this might work in ~/vimrc? Open both files with sudoedit $ sudoedit file1 file2 Vertically split one buffer :vsp | b2 In each window, run :diffthis


1

Root can sort of be logged in with an insecure password yes. With sudo su, is this a security issue? You have to decide that on your own (you can forbid sudo from using the su command to bypass that), similarly it depends on how you are using sudo, if you are giving your user account full access to any desired command through sudo, then of course, anyone who ...


0

Your have to write an script, which contains expect ,sudo and make install to solve your problem and your system() function call your script such as : system("myscrip.sh"); For reading expect : How to login as root from Bash and do stuff


-1

The following command is very useful: xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p' But you need to set DISPLAY variable and it's related to your position to xev machine. NOTE: When you apply DISPALY variable that your position is illlegal, or you don't have any local access to ...


3

All¹ X11 programs open their windows on the display indicated by the environment variable DISPLAY. Thus: sudo -u 1000 env DISPLAY=:0 xev or for that matter, since you can run programs as a different user from the X server, just DISPLAY=:0 xev :NUMBER is the notation for local displays; in most scenarios, the X11 server that is running on the console is ...


1

You should try: xev --display localhost:0.0 assuming that X is actually running.


1

I'm betting the program you're trying to run requires a newer version of GLIBC than is current installed on your system. Unfortunately, because it is GLIBC, there is no way to get a newer version without having root access and without affecting the entire system. Check the program's upstream site, make sure it's supported on RHEL 6.


0

Your need is an excellent use case for Ansible. It's an open source configuration mgmt / orchestration tool that will solve this issue for you. It is agentless and works over SSH so you typically don't need to do any client setup.


0

You should pass the command directly to su: su <username> -c 'service <software> start' If you simply execute the line su <username> then you start an interactive shell as that user. It's a bit strange that starting the service should be done as the specified user; it's more usual that the start script takes care of running whatever as ...


1

You cannot use sudo with redirection, because the redirection is done by your original shell which runs as your own user code. It tries to set up a file descriptor for the file mentioned after the >, which fails as your user is not able to write to it. Costas's method works, as does spawning a subshell: sudo sh -c "echo disabled > ...


0

I just gave an an alternative answer here without redefining sudo with an alias. In your case it would be: type -a startapp | grep -o -P "(?<=\`).*(?=')" | xargs sudo All in one line, no extra shells, no alias redefinitions. ;-)


0

Without changing ssh configuration, you can create two ssh tunnels host->server1 and server2->host through the ssh connection to server2. Connect these two tunnels on the host machine (same port). And run sudo on server2 to retrieve data from connected tunnels on server1 and save them on server2. ssh -L60000:${source}:22 -R60000:localhost:60000 -t ${target} ...


0

After long time, I am able to find the answer. Problem: ==> The hrsupport not able to cd to home/someone/public_html, which is having nobody as a group Solution: ==> I added the hrsupport user to the group nobody Problem Solved.


2

If it, as you say, "needs to run at startup on an unpriveleged user account", then it will necessarily have access to all files that the unpriveleged user account in question has access to. You could create a dedicated unpriveleged user account for the purpose of running the script. Set the permissions on the secret key file so that only that dedicated user ...



Top 50 recent answers are included