Why would `sudo cp src dst` ignore no clobber rule in /etc? [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Why does sudo ignore aliases?
4 answers
My global preferences, alias cp='cp -iv'
, is ignored by sudo
while using zsh
.
I'm setting up a new system, and I'm trying out zsh for my user account. The root user still has bash. In /etc
I have:
/etc/bash.bashrc
/etc/zsh/zshenv
Both of these have the above alias, alias cp='cp -iv'
.
In the user's directories, neither of these contains the commands in the /etc
global configs.
~/.zshenv
/root/.bashrc
If I switch to the root user su -
and try to clobber a file with copy, I get the correct prompt, cp: overwrite 'fruits/apple.txt?'
. The same for the home user. However, if I sudo
the copy command for the home user while in zsh, the file is overwritten! Using bash, I've not experienced this problem before, so I don't have a clue where else to look.
bash command-line sudo zsh
marked as duplicate by Jeff Schaller, Community⦠Nov 19 '17 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
Why does sudo ignore aliases?
4 answers
My global preferences, alias cp='cp -iv'
, is ignored by sudo
while using zsh
.
I'm setting up a new system, and I'm trying out zsh for my user account. The root user still has bash. In /etc
I have:
/etc/bash.bashrc
/etc/zsh/zshenv
Both of these have the above alias, alias cp='cp -iv'
.
In the user's directories, neither of these contains the commands in the /etc
global configs.
~/.zshenv
/root/.bashrc
If I switch to the root user su -
and try to clobber a file with copy, I get the correct prompt, cp: overwrite 'fruits/apple.txt?'
. The same for the home user. However, if I sudo
the copy command for the home user while in zsh, the file is overwritten! Using bash, I've not experienced this problem before, so I don't have a clue where else to look.
bash command-line sudo zsh
marked as duplicate by Jeff Schaller, Community⦠Nov 19 '17 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Why does sudo ignore aliases?
4 answers
My global preferences, alias cp='cp -iv'
, is ignored by sudo
while using zsh
.
I'm setting up a new system, and I'm trying out zsh for my user account. The root user still has bash. In /etc
I have:
/etc/bash.bashrc
/etc/zsh/zshenv
Both of these have the above alias, alias cp='cp -iv'
.
In the user's directories, neither of these contains the commands in the /etc
global configs.
~/.zshenv
/root/.bashrc
If I switch to the root user su -
and try to clobber a file with copy, I get the correct prompt, cp: overwrite 'fruits/apple.txt?'
. The same for the home user. However, if I sudo
the copy command for the home user while in zsh, the file is overwritten! Using bash, I've not experienced this problem before, so I don't have a clue where else to look.
bash command-line sudo zsh
This question already has an answer here:
Why does sudo ignore aliases?
4 answers
My global preferences, alias cp='cp -iv'
, is ignored by sudo
while using zsh
.
I'm setting up a new system, and I'm trying out zsh for my user account. The root user still has bash. In /etc
I have:
/etc/bash.bashrc
/etc/zsh/zshenv
Both of these have the above alias, alias cp='cp -iv'
.
In the user's directories, neither of these contains the commands in the /etc
global configs.
~/.zshenv
/root/.bashrc
If I switch to the root user su -
and try to clobber a file with copy, I get the correct prompt, cp: overwrite 'fruits/apple.txt?'
. The same for the home user. However, if I sudo
the copy command for the home user while in zsh, the file is overwritten! Using bash, I've not experienced this problem before, so I don't have a clue where else to look.
This question already has an answer here:
Why does sudo ignore aliases?
4 answers
bash command-line sudo zsh
edited Nov 19 '17 at 17:21
Jeff Schaller
32.1k849109
32.1k849109
asked Nov 19 '17 at 16:51
xtian
275210
275210
marked as duplicate by Jeff Schaller, Community⦠Nov 19 '17 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Jeff Schaller, Community⦠Nov 19 '17 at 17:43
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Workaround for sudo
to work with your aliases, e.g. sudo cp
...
alias sudo='sudo '
That's the answer--alias expansion of sudo was required in/etc/zsh/zshenv
.
â xtian
Nov 19 '17 at 17:50
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Workaround for sudo
to work with your aliases, e.g. sudo cp
...
alias sudo='sudo '
That's the answer--alias expansion of sudo was required in/etc/zsh/zshenv
.
â xtian
Nov 19 '17 at 17:50
add a comment |Â
up vote
0
down vote
accepted
Workaround for sudo
to work with your aliases, e.g. sudo cp
...
alias sudo='sudo '
That's the answer--alias expansion of sudo was required in/etc/zsh/zshenv
.
â xtian
Nov 19 '17 at 17:50
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Workaround for sudo
to work with your aliases, e.g. sudo cp
...
alias sudo='sudo '
Workaround for sudo
to work with your aliases, e.g. sudo cp
...
alias sudo='sudo '
answered Nov 19 '17 at 17:35
Vlastimil
6,4361147119
6,4361147119
That's the answer--alias expansion of sudo was required in/etc/zsh/zshenv
.
â xtian
Nov 19 '17 at 17:50
add a comment |Â
That's the answer--alias expansion of sudo was required in/etc/zsh/zshenv
.
â xtian
Nov 19 '17 at 17:50
That's the answer--alias expansion of sudo was required in
/etc/zsh/zshenv
.â xtian
Nov 19 '17 at 17:50
That's the answer--alias expansion of sudo was required in
/etc/zsh/zshenv
.â xtian
Nov 19 '17 at 17:50
add a comment |Â