I am using REDHAT/CENTOS 6.5.

I used to have access to directories, but now when I try to go into them after I rebooted by UNIX, it tells me that permission is denied.

Using stat command on these directories it seems my user (which is not root) does not have access to these directories anymore even though I created them with this user. I might have corrupted, erased or done something to my .bashrc or some other file - I am a novice in UNIX.

Then, I try sudo chmod go+rx on the directory, its asks for the user name password and I enter it and it says "user" (user being my user name locally) is not in the sudoers file and this incident will be reported.

I think I erased some files in my root directory.

What did I do or erase to cause this to happen and how can I fix it?

Also when I change to root user now, the command line just says -bash-4.1 and nothing else. I must have erased something in the root directory or something. I am new to UNIX so I am not sure.

Can this be fixed?

Update: Now it seems I cannot write anything in the directories also.

  • Do you remember running a chmod command with the -R flag on anydirectories, possibly / or /usr?
    – Kusalananda
    Apr 28, 2020 at 6:27

1 Answer 1


First, become root using su -

Fix the root's homedir:

mkdir /root
cp -a /etc/skel/.* /root/

Make sure your own username is in wheel group:

usermod -a -G wheel yourusername

Make sure wheel group can sudo. Open /etc/sudoers using visudo and make sure this line exists and is not commented (no # in the beginning of the line):

%wheel  ALL=(ALL)       ALL


  • 2
    You shouldn't edit /etc/sudoers with anything other than the visudo command -- if you mess up its contents, you can easily make a bad situation even worse. Apr 28, 2020 at 5:17
  • Thanks @GordonDavisson . Updated the answer
    – GMaster
    Apr 28, 2020 at 5:26
  • Whats in cp -a /etc/skel/.* ??
    – user4434
    Apr 29, 2020 at 6:21
  • @sheeple That contains the dotfiles like .bashrc, .profile. You can cd /etc/skel and ls -a to see for yourself.
    – GMaster
    Apr 29, 2020 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .