Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've noticed that also. Specifically when I'm root. I just did a little test to verify that if I'm not root I do not get prompted.
Not an explanation just an observation.
I've noticed that also. Specifically when I'm root. I just did a little test to verify that if I'm not root I do not get prompted.
Not an explanation just an observation.
Thanks for the quick response.
Never noticed that, but that is the same for me. With a normal user, no prompt, with root, it always prompts.
This is a security measure for the root account, given its godly powers over your machine.
Take a look inside root's .bashrc file. You should find an alias to cp that includes the -i option. Remark that line to make cp operate like a normal user.
I can see why they do it now for root. Maybe I'm thinking cp, rm, & mv should prompt by default and have a parameter to skip the prompt. Seems to make more sense that way.
I can see why they do it now for root. Maybe I'm thinking cp, rm, & mv should prompt by default and have a parameter to skip the prompt. Seems to make more sense that way.
Yep, but they don't by default. Even if they did, the aliases in root's .bashrc forcibly cause the commands to question your actions, no matter what options you send to the commands. Not as important for normal users, as all they can mess with are things they have permissions to.
On another note, the aliases allow you to change the default behavior of any commands. So, if you've got a certain command that you're always setting parameters on, you can give it an alias. The name of the alias itself does not have to be the same as the command itself.
For instance,
Code:
alias cpi='cp -i -v'
would give allow you to issue "cpi" as a command that runs "cp -i -v".
Im not no expert at linux but check your alias, your cp might be set to cp -i in the alias and if you wish, you would change that warning but i dont see why anyone would want to change it considering the mess you would be if you were to delete something by invoking the wrong command .. ha.
Yep, but they don't by default. Even if they did, the aliases in root's .bashrc forcibly cause the commands to question your actions, no matter what options you send to the commands. Not as important for normal users, as all they can mess with are things they have permissions to.
I think it's a bad thing - what if you happen to get
access to a box that (for whatever reason!) doesn't
have that alias defined?
There's nothing that should replace your sanchin when
dealing with anything as root; particularly not aliases
that lull you into a false sense of safety.
I think it's a bad thing - what if you happen to get
access to a box that (for whatever reason!) doesn't
have that alias defined?
There's nothing that should replace your sanchin when
dealing with anything as root; particularly not aliases
that lull you into a false sense of safety.
Cheers,
Tink
I agree it's a bad thing that the default is to auto-overwrite/delete without confirmation. I was saying that it would be logical thinking that a command would operate with effectively the same behavior no matter what account it is executed with. So, being that it doesn't require confirmation as normal user, one might assume the same as root.
I rather think it could be a good idea to place the aliases in normal user's .bashrc files, except that (I believe) the -i overrides the -f, so would render -f nonfunctional. So, I suppose maybe the best solution would be to recompile cp/rm/mv so that -i is default.
Term from bushido. I've been taught that it literally translates
to "three battles", and that it means a state of alertness, hightened
awareness. It's a stance in Karate, and also the name of a kata.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.