When I type into bash the following command su -s /bin/bash as root, then no error occurs.

When I type su -s /bin/bash -m [MyUserName], then I get the error: Permission denied.

As far as I could find out, it has something to do with the /etc/bashrc file.

I looked: /etc has permissions 754 and /etc/bashrc has permissions 544

There are a lot of adives to change the permission to allow execution of that file. Question: Do I really need execution permission? Why? Or is there any other way to solve that problem?


There are some demands to give some more information. So here are they:

The command su -s /bin/bash -m [MyUserName] is the command I extracted from the whole command su -s /bin/bash -m [MyUserName] /some/path/tomcat/bin/startup.sh -[some] [args].

First I thought, it has something to do with tomcat, but when I can type in su -s /bin/bash -m [MyUserName] without the tomcat part then the problem is not the tomcat part. As far as I know, the whole command is used, to start command as a special user.

  • If I'm right, this command would execute bash in your own name, preserving the environment (your user name isn't an argument of -m option because it doesn't take any). Why would you do that ? From which user are you executing this command ?
    – Raspbeguy
    Commented Sep 17, 2015 at 11:21
  • I think OP rather want root -> myuser. there is no need to change /etc/bashrc, this file is read by /bin/bash. can you give us the result of which su ?
    – Archemar
    Commented Sep 17, 2015 at 11:23
  • @Archemar: /usr/bin/su
    – devopsfun
    Commented Sep 17, 2015 at 11:25
  • su - myuser should work. Can you log into myuser ? does it (myuser) have a proper shell ? does it home dir (the one specifyied in /etc/passwd) is writable ?
    – Archemar
    Commented Sep 17, 2015 at 11:29
  • No, you don't need execute permissions on /etc/bash.bashrc. Could you edit your question and explain what you are trying to do? Why would you want to run su -s /bin/bash -m [MyUserName]? The -m option enables monitor mode, it doesn't take a username as an argument.
    – terdon
    Commented Sep 17, 2015 at 11:33

2 Answers 2


The problem is your permissions for /etc. These must be 755, not 754.

The full error text is as follows:

su -s /bin/bash -m roaima
Password: _
bash: /etc/bash.bashrc: Permission denied
I have no name!

This shows that the system is struggling to read /etc/passwd to derive the details of your home directory, full name, etc.

Fix the permissions on /etc and the problem will resolve itself.


Use the man page:

-m, -p, --preserve-environment
    Preserves  the  whole  environment, ie does not set HOME, SHELL,

So running 'su -m ' as root will make bash to read ~/.bashrc which expands (due to preserved environment) to /root/.bashrc which you have no rights as user. Your /etc and /etc/bashrc permission are wrong also, it should be 755 for /etc & 644 for /etc/bashrc.

  • This does not work. I changed the permissions. Also for /root/.bashrc to 755, but that does not help.
    – devopsfun
    Commented Sep 17, 2015 at 13:21
  • @kristian You've misunderstood my reply. I'm pointing out the reason why using the command (su -m as root) it's going to print (and only print) a "Permission denied". Changing arbitrary permission on files it's not a correct way to deal with this (hint /root must be at least 711 but you don't want that). Having read your edit, you might try the command 'su [user] -c "/some/path/tomcat/bin/startup.sh -[some] [args]"' and see if that works?
    – nkms
    Commented Sep 17, 2015 at 14:10

You must log in to answer this question.

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