The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Shell quirk

Discussion in 'General Discussion' started by mickalo, May 29, 2009.

  1. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    We just moved to a new server w/Cpanel and notice when logged as root, and using the 'rm' command without the -f flag, we don't get the prompt [y/n] to confirm the command.

    On our old server we always got a prompt to confirm before it removed. Is there a setting some where that can be set so that it does prompt [y/n] before it removes?? It's a little unnerving not being prompted before it removes.

    thx's

    Mike
     
  2. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Check your .bashrc file for aliases. You should have something like:

    alias rm='rm -i'

    That will force interaction when using the rm command.
     
  3. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    I checked that file and that's in there. this is the file:
    Code:
    # .bashrc
    
    # User specific aliases and functions
    
    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
    
    # Source global definitions
    if [ -f /etc/bashrc ]; then
    	. /etc/bashrc
    fi
    
    when I login this is what the shell prompt looks like:
    Code:
    [Load: 0.03] [Time: 19:57:31]
    [root@justlightening ~]: 
    
    is there something else I can check ??

    Mike
     
  4. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
  5. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    it returns "/bin/bash"

    now if I change the passwd file to /bin/csh for root then the "rm" works like it should, prompting before it removes without the -f flag.

    this is a Centos 5 system incase that makes a difference.

    Mike
     
  6. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Are you logging in directly as root, or, are you switching users to root? If you are switching users to get to root, are you using the "su -" command, to assume the users environment?
     
  7. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    logging directly as root. no 'su' command

    Mike
     
  8. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Have you tried using rm -i and see if it prompts you? This does seem like very strange behavior.
     
  9. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    if i use 'rm -i' then I get prompted before it deletes ... very strange!

    Mike
     
  10. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Just thinking, what are the permissions on the .bashrc file?
     
  11. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    -rw-r--r-- 1 root root 176 Aug 29 2008 .bashrc
     
  12. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    OK, that's 644, same as what I have. When you type "alias" at the prompt, does it list rm -i?
     
  13. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    no it shows

    alias rm='rm -rf'

    which isn't right is it ??

    I believe I fixed it now. typed at the prompt: alias rm='rm -i' which seems to have corrected it now.

    Mike
     
    #13 mickalo, May 29, 2009
    Last edited: May 29, 2009
  14. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
    Good news :)

    Still rather odd it happened in the first place :confused:
     
  15. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    Thanks of all your help Chris. ;)

    Yea it was odd. We just setup this server a couple of weeks ago.

    Mike
     
Loading...

Share This Page