Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

2 total

sudo shell

# cf. http://nevali.net/2006/04/sudo-and-su/
#function sudosh() { /usr/bin/sudo -H -i; return 0; }
alias sudosh='/usr/bin/sudo -H -i'

sudosh

echo $SHELL
echo $BASH

exit

alias sudobash='/usr/bin/sudo /bin/bash -H -i'

sudobash

echo $SHELL
echo $BASH
bash --version

Remove sudo password request when deploying

Change the sudoers list by adding a NOPASSWD: [Cmnd_Alias] line.

In terminal: visudo

# Cmnd alias specification
Cmnd_Alias HTTPD = /usr/local/sbin/apachectl, /etc/init.d/apache2

# User privilege specification
[user] ALL = NOPASSWD: HTTPD


Be sure that the NOPASSWD line is last in visudo, else, it risks being overwritten by later specifications.
2 total