1

I have a problem. When I enter a Ubuntu machine, I see this messages:

Could not chdir to home directory /home/root: No such file or directory /usr/bin/xauth: error in locking authority file /home/root/.Xauthority 

When I make whoami, I receive the answer: root

but no directory /home/root exist.

When I am trying to create a new user: adduser blabla, I receive this error:

adduser: Only root may add a user or group to the system. 

When I am trying to create it in a different way: useradd -m blabla, I receive:

useradd: Permission denied. useradd: cannot lock /etc/passwd; try again later. 

someone can explain me what went wrong?

Thanks in Advance

5
  • 2
    Are you connecting to a remote machine via ssh? Or is this a local machine? ... There typically is no /home/root directory. The root home is typically located at /root From the error messages, it would appear that you are not the root user for the system. Did you create a user named root? Commented Oct 30, 2017 at 16:01
  • I did log in to a machine. It may be indeed a root user created, but not by me - I am checking it now Commented Oct 30, 2017 at 16:07
  • Can I remove it safely using "sudo userdel root"? Commented Oct 30, 2017 at 16:17
  • "Can I remove it safely using "sudo userdel root"?" No it hurts..., if you dont need root just block root user with the command passwd -l root (l = lowercase L) .... and if you have ssh, change PermitRootLogin to no for guarantee... If the actual root user is not working properly edit /etc/passwd and change UID and GID to 0 ... Commented Oct 30, 2017 at 16:40
  • 1
    What is the output of cat /etc/passwd | grep root ... it should look almost identical to this: root:x:0:0:root:/root:/bin/bash Commented Oct 30, 2017 at 17:11

1 Answer 1

3

Try to figure out what is your current id (by issuing id command in shell), user root should have uid=0. If your uid is different from 0, you is not under privileged account. Also, what`s happening if you issue command sudo -i ?

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.