All Questions
22 questions
0
votes
3
answers
286
views
How to avoid nesting root shells? (POSIX)
Consider the following Bash alias, just something that came to mind quickly, and I did not have time to dig further:
alias su='sudo -s'
Note, that I am running Bash, though I would like the solution ...
1
vote
1
answer
287
views
How to call many shell functions from sudo?
I have a huge alias file sourced by ~/.bashrc or ~/.zshrc which contains both simple aliases and more functions for more complex stuff:
# example aliases
alias "sudo=sudo "
alias "...
1
vote
1
answer
381
views
!!: command not found
Recently, I was getting a bit frustrated about not running commands as admin, and started using sudo !! a lot. I decided that, for ease of use, I'd create an alias ffs for that exact line. I added the ...
0
votes
1
answer
673
views
How do I source a new .bashrc in an alias that switches my shell?
I have an alias I use to run sudo -s called ssu. I want it to also source my root session from the .profile in my home directory.
Other answers seem to say that this is the solution:
alias ssu='sudo -...
0
votes
2
answers
1k
views
Expand (certain) aliases from within sudo bash function
There are two things I want: 1) I want that if I keep using sudo often that it never asks me for my password by updating my cached credentials every time I type sudo, 2) That I can use (certain) ...
0
votes
2
answers
86
views
sudo misinterpreting aliases
In my ~/.bashrc I have the alias link='ln -sf' set, and it's working accordingly during my shell sessions.
However, for root protected locations, where I need to use sudo in the command beginning, it ...
2
votes
1
answer
762
views
How to run a previous command (that uses an alias) with sudo, both in command line and with an alias
(Note: This is not a duplicate question.)
On the command line, you can simply use sudo !! to run the previous command with sudo. However, how would this be done if the previous command uses an alias?
...
0
votes
1
answer
379
views
Having sudo and non-sudo parts in an alias - why does it not work with >>?
I was trying to use an alias which should run two commands, where the first is fine to be run with normal user privileges and the second one needs sudo privileges.
alias hosts-get="scp [email protected]:...
-1
votes
2
answers
405
views
alias the find function and use it with sudo [duplicate]
I'm having trouble creating an alias so I can run find in "silent mode" (without all the Permission denied messages). my bash skills are pretty bad so I'm not sure how to fix this
here's my alias in ~...
-1
votes
1
answer
1k
views
allow user access to syslog
I'm running an embedded Linux (Dreadnaught), and I'd like to be able to manually enter a line into the syslog as the user login, and have the result of other commands stored in the syslog. e.g.:
...
2
votes
2
answers
3k
views
Insert alias in sudoers file
I have created an alias for myuser that is
alias up='sudo apt update && sudo apt -y upgrade && sudo apt -y autoremove'
It is stored in the user's .bashrc file.
I have tried to modify ...
0
votes
1
answer
208
views
Properly defined alias or function instead of `sudo nemo .`
OS: Linux Mint 18.x Cinnamon 64-bit
Say, I would like to run nemo, the default file manager in Cinnamon, with normal sudo, and in current working directory:
sudo nemo .
Problems:
It shows ...
2
votes
2
answers
2k
views
Executing Alias Command as Another User Fails
Not sure what I'm doing wrong here.
User2 sources a file in it's .bash_profile to set environment specific aliases.
# .bash_profile
source $HOME/set_environment_shortcuts
Inside $HOME/...
1
vote
2
answers
3k
views
Alias that runs a command using sudo
Im always running a particular app as root because it requires more privileges.
I usually just sudo it.
I want to make an alias that is something similar to:
alias myCmd='sudo nohup /path/to/binary &...
6
votes
1
answer
1k
views
Load aliases from .bashrc file while using sudo
I have set aliases for a few programs in the .bashrc file, and they work fine without sudo and they don't with sudo.
Is there a way to get those aliases work with sudo?
For example:
nano text.txt #...
5
votes
1
answer
5k
views
Why root bash output is colored but `sudo ls` output is not?
In bash (I am using Ubuntu 12.04) I get colored outputs either as root (after sudo su) or as a normal user.
I checked (after reading this post) the files .bashrc for normal user and superuser and ...
4
votes
5
answers
8k
views
Use alias after issuing sudo su command
I am on AIX 7.1.
I have a bunch of aliases defined in my personal .profile.
alias df='df -k'
alias cl=clear
alias h=history
alias ll='ls -al'
alias lt='ls -latr'
alias ls='ls -Fa'
alias psj='ps -ef |...
5
votes
2
answers
5k
views
Run command with sudo by default
I need a linux user (lets call him "bob") who is allowed to run a list of commands which require root privileges. So let him be required to run /sbin/firstcommand and /sbin/secondcommand (which are ...
34
votes
4
answers
20k
views
Why does sudo ignore aliases?
I am running Ubuntu 10.04 and I use upstart for daemon management. My enterprise application is run as a daemon and must be run as root because of various privileges. E.g.:
sudo start my-...
3
votes
1
answer
1k
views
Getting sudo to work for an alias
I installed Sublime Text 3 in Fedora 20 which has got GNOME, as I couldn't get it being called from terminal I created a .bash_aliases file which a line like this:
alias sublime='sublime_text'
And ...
63
votes
6
answers
48k
views
How can I `alias sudo !!`?
I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints
sudo: !!: command not found
If I use double quotes, it substitutes ...
6
votes
1
answer
2k
views
How to enable `sudo` with custom functions?
Recently I learned you can enable sudo for custom aliases as follows:
alias sudo='sudo ' # note: the space is required!
The reason this works is the following:
If the last character of the alias ...