By mistake I changed /bin to a user/group. Is there a way to revert to the default users/groups? The command I executed is:
chown -R -H -v starlord:starlord /bin
By mistake I changed /bin to a user/group. Is there a way to revert to the default users/groups? The command I executed is:
chown -R -H -v starlord:starlord /bin
/bin
with setuid
bit setOn a clean install, the following files in bin
have the setuid
bit set (according find /bin -perm -4000
):
/bin/ping
/bin/ping6
/bin/su
/bin/umount
/bin/fusermount
/bin/mount
/bin/ntfs-3g
Note: You may have installed software which adds to that list (or which, for some reason, has the setgid
bit set), so the following may not work completely, since it will leave the setuid
bit off of anything not in that list.
sudo chown -R -H root:root /bin
sudo chmod u+s /bin/ping /bin/ping6 /bin/su /bin/umount /bin/fusermount /bin/mount /bin/ntfs-3g
It's rarely a good idea to modify anything in /bin
, which is reserved for files installed and maintained via the package manager. The package manager, not you, owns /bin
.
If you remove something, the things that depend on it will break. If you change or add something, your changes can be obliterated in a future update via the package manager.
Instead, store programs useful for all users in places like /usr/local/bin
and /usr/local/sbin
. Store programs useful for only one user in ~user/bin
. Those places are owned and managed by the system administrator and the individual user respectively.
If you still want to ignore that advice, the correct way to modify things in /bin
is to use sudo
. For example, you can copy a file into /bin
with:
sudo cp program /bin
You can delete it with:
sudo rm /bin/program
Try running sudo chown -R -H root:root /bin
Provided you haven't also run any chmod
commands on /bin
that should revert things back to the way they should be
ping 8.8.8.8
, which gives ping: socket: Operation not permitted
twice.
– Chai T. Rex
Apr 17 '17 at 19:32
/etc
to/bin
– Zanna Apr 17 '17 at 18:22chown -R
orchmod -R
, since the permissions are usually set the way they are for good reasons. Take the time to figure out how to do things in the "proper" way to avoid headaches. – Chai T. Rex Apr 17 '17 at 19:27