Can I prevent fabric from prompting me for a sudo password?

Try passing shell=False to sudo. That way /bin/bash won’t be added to the sudo command. sudo(‘some_command’, shell=False) From line 503 of fabric/operations.py: if (not env.use_shell) or (not shell): real_command = “%s %s” % (sudo_prefix, _shell_escape(command)) the else block looks like this: # V– here’s where /bin/bash is added real_command = ‘%s %s “%s”‘ % (sudo_prefix, … Read more

How to write a shell script that runs some commands as superuser and some commands not as superuser, without having to babysit it?

File sutest #!/bin/bash echo “uid is ${UID}” echo “user is ${USER}” echo “username is ${USERNAME}” run it: `./sutest’ gives me uid is 500 user is stephenp username is stephenp but using sudo: sudo ./sutest gives uid is 0 user is root username is stephenp So you retain the original user name in $USERNAME when running … Read more

What does sudo -H do?

Generally man sudo (the exact text may vary, but it will be similar): -H The -H (HOME) option requests that the security policy set the HOME environment variable to the home directory of the target user (root by default) as specified by the password database. Depending on the policy, this may be the default behavior. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)