-1

I am trying to login to my Ubuntu terminal as super user, but terminal says "Cannot execute :No such file or directory"

output from terminal :

gowtham@gowtham:~$ sudo su
[sudo] password for gowtham:
Cannot execute gowtham: No such file or directory
gowtham@gowtham:~$

where "gowtham" is my username.

njachowski
  • 927
  • 5
  • 14
Gowtham
  • 39
  • 1
  • 7
  • I am not sure what is going on, but you may be able to get the effect you would like with `sudo -i`. – skyler Jan 20 '16 at 06:26
  • I tried sudo -i , but terminal says "command not found" – Gowtham Jan 20 '16 at 06:35
  • Check what default shell is set for the root user: `cat /etc/passwd`. Maybe a default shell "gowtham" is set which does not exist and therefore cannot be executed. – mnille Jan 20 '16 at 06:39
  • What does `echo $PATH` give you? – njachowski Jan 20 '16 at 07:14
  • echo $PATH gives : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-oracle/bin:/usr/lib/jvm/java-7-oracle/db/bin:/usr/lib/jvm/java-7-oracle/jre/bin:/usr/lib/jvm/java-7-oracle/bin – Gowtham Jan 20 '16 at 07:35
  • I tried to fin default shell by `echo $SHELL` it provides : /bin/zsh – Gowtham Jan 20 '16 at 07:45
  • It would be helpful if you would show us the content of `/etc/passwd` as I asked my previous comment – mnille Jan 20 '16 at 08:10
  • As a workaround, try `sudo bash`. – tripleee Jan 20 '16 at 08:12
  • Not a programming question; nominating to close as off-topic. Maybe flag for moderator attention and request migration e.g. to https://askubuntu.com/ – tripleee Jan 20 '16 at 08:13
  • sorry mnille. gowtham@gowtham:~$ sudo /etc/passwd [sudo] password for gowtham: sudo: /etc/passwd: command not found gowtham@gowtham:~$ – Gowtham Jan 20 '16 at 08:55
  • thank you so much tripleee.. finally it worked. gowtham@gowtham:~$ sudo bash root@gowtham:~# – Gowtham Jan 20 '16 at 08:57
  • @Gowtham: `/etc/passwd`should be world-readable, so do not have to be root to see the content of it. – mnille Jan 20 '16 at 09:53

1 Answers1

0

Your passwd file might be wrong. Try editing it:

sudo nano /etc/passwd

Edit it from:

root:x:0:0:root:/root:somerandomfile

to

root:x:0:0:root:/root:/bin/bash
ctotolin
  • 183
  • 5
  • Thank you so much cristian, I changed as you said., it got worked, now `sudo su` is perfectly working for me. – Gowtham Jan 20 '16 at 09:09
  • 'root' account disabled for security reason in Ubuntu, you provided with `sudo` to execute commands as root (it is considered more secure way). If you enabled 'shell' for user account then assign a password as well to root user and you do not need do `sudo su`, just `su` will be sufficient. [How to Enable and Disable Root User Account in Ubuntu](https://linuxize.com/post/how-to-enable-and-disable-root-user-account-in-ubuntu/), [su](http://man7.org/linux/man-pages/man1/su.1.html) – Polar Bear Mar 13 '20 at 17:19