March 11, 2014 1.1k views
hello digital ocean, then q did the tutorial swapfile I can no longer log in with my normal User, the permission denied and it was after these commands, such as undo them or allow me loge with a normal User is not root sudo chown root: root / swapfile sudo chmod 0600 / swapfile plz help me
1 Answer
Did you have any snapshots of your server before running these commands?
The reason I'm asking is that you have some errors in your commands, allow me to explain:

sudo chown root: root / swapfile
^ ^

Notice there's a space between ":" and "root" and also another space between "/" and "swapfile". What this means is that you assigned EVERYTHING under "/" (basically all your filesystem) to the root user with an inexistent group (" root").

sudo chmod 0600 / swapfile

Same as before, the space between "/" and "swapfile" is interpreted as a separator, meaning that you are applying the file permissions 0600 (Read-Write only to the group) to EVERYTHING under "/" and a file called "swapfile" that should be in the current directory, and since no group called " root" (with a space) exists, nothing else has permissions to do anything in your server rendering it unusable.
Have another answer? Share your knowledge.