10

I'm stuck in a login loop Ubuntu 17.04. When I go to tty1 and type chown username:roey .Xauthority taken from Ubuntu gets stuck in a login loop

It says that my user doesn't exist.

What is the problem? How can I log back in to Ubuntu-Gnome?

Zanna
  • 69,223
  • 56
  • 216
  • 327
Roey
  • 668
  • 1
  • 8
  • 18

2 Answers2

12

The command is

sudo chown roey:roey .Xauthority

1st roey is the user, 2nd is the group roey

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
9

If you don't know what username/group you shoud use, I suggest using something like this:

sudo chown $USER:`id -gn` .Xauthority
  • $USER will be expanded into your current username.
  • id -gn will returns the main group of your current user.
Ravexina
  • 54,268
  • 25
  • 157
  • 179
  • 1
    Are you sure you don't mean `$USER:\`id -gn\`` (note the colon character in the middle)? Also, that would be equivalent to just `$USER:` since `chown` uses the primary group of the specified user if you omit the group name. – David Foerster May 19 '17 at 20:15
  • @DavidFoerster Both `:` and `.` will work fine, didn't know about omitting group like `$USER:`, good point +1 :-) – Ravexina May 19 '17 at 20:25
  • check `info coreutils` and the section which is about `chown`. I'll change it to `:` in case of username contains dot. – Ravexina May 19 '17 at 20:44
  • 1
    Indeed: “New scripts should avoid the use of \`.' because it is not portable […].” Looks like we both learned something today. :-] – David Foerster May 19 '17 at 20:47
  • Yeah, I just used it to show an alternative approach and it caused us to learn something new :) – Ravexina May 19 '17 at 20:48