How Can I return back to root:root owner ? Lab - Change de default db path :

Hello Everyone,

I made a stupid thing, I changed owners of all the /var directories to vagrant:vagrant :

sudo chown -R vagrant:vagrant /var

drwxr-xr-x 2 vagrant vagrant 4096 Apr 10 2014 backups
drwxr-xr-x 11 vagrant vagrant 4096 Nov 7 18:17 cache
drwxr-xr-x 3 vagrant vagrant 4096 Jan 30 19:58 chef
drwxrwxrwt 2 vagrant vagrant 4096 Feb 2 19:31 crash
drwxr-xr-x 50 vagrant vagrant 4096 Jan 30 20:00 lib
drwxrwsr-x 2 vagrant vagrant 4096 Apr 10 2014 local
lrwxrwxrwx 1 vagrant vagrant 9 Nov 7 15:16 lock -> /run/lock
drwxrwxr-x 11 vagrant vagrant 4096 Feb 8 15:59 log
drwxr-xr-x 3 vagrant vagrant 4096 Jan 30 20:00 m103
drwxrwsr-x 2 vagrant vagrant 4096 Nov 7 15:16 mail
drwxr-xr-x 3 vagrant vagrant 4096 Feb 7 23:01 mongodb
drwxr-xr-x 2 vagrant vagrant 4096 Nov 7 15:16 opt
lrwxrwxrwx 1 vagrant vagrant 4 Nov 7 15:16 run -> /run
drwxr-xr-x 5 vagrant vagrant 4096 Nov 7 15:16 spool
drwxrwxrwt 2 vagrant vagrant 4096 Nov 7 15:19 tmp

how can I retrun back the owner root:root to the others directories except /var/mongodb/db
Some directories was owned by root:mail or root:syslog

I tried this command, but doesn’t work :

vagrant@m103:~$ sudo chown -R rout:rout /var
chown: invalid user: ‘rout:rout’

Thanks for your help !

Kindly
Otmane

It is root:root, not rout:rout. Typos are the most cause of errors.

1 Like

Yes, it’s really stupid to make this kind of error,
I have to visit a doctor to make a galsses :nerd_face:

Thanks you @steevej-1495 again for your help, it works

1 Like

Closing this thread as the issue has been resolved.