Created
January 31, 2014 20:39
-
-
Save hihellobolke/8742680 to your computer and use it in GitHub Desktop.
sudo2ssh - a sudo that is basically ssh as root to localhost, written as bash function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo () { | |
| echo "sudossh wrapper i.e. 'ssh root@localhost'"; | |
| curdir=$(pwd); | |
| sudossh="ssh -q -t"; | |
| if [[ "${1-bash}" == "bash" ]]; then | |
| $sudossh root@localhost "PATH=$PATH; export PATH; PS1=(ROOT)$PS1; export PS1; cd $curdir && bash"; | |
| else | |
| $sudossh root@localhost "PATH=$PATH; export PATH; PS1=(ROOT)$PS1; export PS1; cd $curdir && $@"; | |
| fi | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment