root@frankfurt:~# sudo adduser newuser Adding user `newuser' ... Adding new group `newuser' (1001) ... Adding new user `newuser' (1001) with group `newuser' ... Creating home directory `/home/newuser' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for newuser Enter the new value, or press ENTER for the default Full Name []: new Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y root@frankfurt:~# su newuser Cannot execute /bin/bash: Permission denied root@frankfurt:~#
Thanks.
34 Answers
Change the permission of these folders like this and now you can su to another user.
chmod 755 /
chmod 755 /bin
chmod 755 /lib 1 Check the permissions of
/binfolder# ls -ld /bin drwxr-xr-x 2 root root 4096 May 27 21:39 /binCheck the permissions of all shells available
# ls -l /bin/*sh -rwxr-xr-x 1 root root 1037464 Sep 1 2015 /bin/bash -rwxr-xr-x 1 root root 154072 Feb 17 21:25 /bin/dash lrwxrwxrwx 1 root root 4 Sep 1 2015 /bin/rbash -> bash lrwxrwxrwx 1 root root 4 Feb 17 21:25 /bin/sh -> dash lrwxrwxrwx 1 root root 7 Aug 19 2015 /bin/static-sh -> busyboxSome are links that we should check their targets
# ls -lL /bin/*sh -rwxr-xr-x 1 root root 1037464 Sep 1 2015 /bin/bash -rwxr-xr-x 1 root root 154072 Feb 17 21:25 /bin/dash -rwxr-xr-x 1 root root 1037464 Sep 1 2015 /bin/rbash -rwxr-xr-x 1 root root 154072 Feb 17 21:25 /bin/sh -rwxr-xr-x 1 root root 1964536 Aug 19 2015 /bin/static-shTry another shell
The best is
busyboxbecause it is a static build (No .so library needed)su newuser -s /bin/static-shNext is
dash, low dependencies and installed by defaultsu newuser -s /bin/dashCheck permissions of libraries and their parent folders, you can get list using
ldd# ldd /bin/bash linux-vdso.so.1 => (0x00007ffdefb5a000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f714bbbd000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f714b9b9000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f714b5ef000) /lib64/ld-linux-x86-64.so.2 (0x000055c6bc494000) # ls -ld /lib /lib/x86_64-linux-gnu /lib64 drwxr-xr-x 26 root root 4096 May 15 07:41 /lib drwxr-xr-x 2 root root 4096 May 14 15:52 /lib64 drwxr-xr-x 3 root root 16384 May 27 21:39 /lib/x86_64-linux-gnu # ls -l /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2 lrwxrwxrwx 1 root root 32 Apr 14 23:16 /lib64/ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.23.so lrwxrwxrwx 1 root root 12 Apr 14 23:16 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.23.so lrwxrwxrwx 1 root root 13 Apr 14 23:16 /lib/x86_64-linux-gnu/libdl.so.2 -> libdl-2.23.so lrwxrwxrwx 1 root root 15 Feb 19 09:23 /lib/x86_64-linux-gnu/libtinfo.so.5 -> libtinfo.so.5.9They are just links we need to verify the target files
# ls -lH /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2 ##or # ls -lL /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2 -rwxr-xr-x 1 root root 162632 Apr 14 23:16 /lib64/ld-linux-x86-64.so.2 -rwxr-xr-x 1 root root 1864888 Apr 14 23:16 /lib/x86_64-linux-gnu/libc.so.6 -rw-r--r-- 1 root root 14608 Apr 14 23:16 /lib/x86_64-linux-gnu/libdl.so.2 -rw-r--r-- 1 root root 167240 Feb 19 09:23 /lib/x86_64-linux-gnu/libtinfo.so.5
You probably have a problem with permissions of files inside /lib (or /lib64) and/or files inside /dev.
Check that they belong to root and that at least some of the files inside de lib dir are executable by all users. Try to compare with a "clean" OS to verify which ones need to be executable by all.
You may check permissions and owner for files doing ls -l /lib, for example.
Ref link :
2just to let anybody know, I had the same problem with this error message and the solution for me was:
chmod 755 /
I mistakingly tried to change file permissions of all hidden "dot" files in a folder one level below the root folder which changed the permission of / from 755 to 750 Problem was:
0cd /data; chmod o-rwx .*