If you're just messing with your own files in your home directory, desktop etc, you should never need to use sudo or superuser rights. It's almost certain that chmod 777 -R it is not an appropriate solution for whatever problem you were trying to solve (and as I mentioned above, there is evidence that you have done it to system files in /var/lib too, and I assume to lots of other places). Any other user, or any buggy server software on the machine, may have easy access to overwrite all of these files and directories. In this case, you're changing carefully set up file permissions to be world-writable. All the files you create in your home directory should be modifiable by you anyway (and if not, something funny is going on).Īlso, you need to be fully aware of the consequences of changing file permissions en masse, such as doing it recursively or on a huge number of files. When manipulating files within your home directory, in this case in ~/Desktop, you should not have to use sudo. Secondly, the command you were using: sudo chmod 777 -R foobs Essentially you have an easily hackable system now, and the only easy way to get it back would be to re-install. It's unlikely that this will be the only important system file whose permissions have been changed to be world-writable. Unfortunately, by doing this you've probably pretty much broken all file permissions throughout your system. I imagine you've done this at some stage using a command like sudo chmod 777 -R /. This means that at some stage, you've set /var/lib/sudo to be world-writable. Your question also has a second part to it: your issues with the command sudo chmod 777 -R foobs.įirstly, the following warning indicates a potentially serious security issue on your machine: sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700 The problems with your chmod 777 -R command I just wanted to let you know about the Ubuntu convention of preferring sudo instead and let you know that there is an alternative.Ģ. Just to clarify, you can, if you choose, give the root user a password allowing logins as root as described in answer, if you specifically want to do things this way instead. It's a good security principle not to stay as a superuser for longer than necessary, just to lessen the possibility of accidentally causing some damage to the system (without it, you can only damage files your user owns). However when doing so you just need to be aware that you are acting as a superuser for every command. and this can still be done without any root password, because sudo gives superuser privileges to the su command.Īnd similarly, instead of su - for a login shell you can use sudo su - or its shortcut sudo -i. With sudo, you still have the option of opening a permanent (interactive) superuser shell with the command: sudo su This can lead to people staying in the superuser shell for longer than necessary just because it's more convenient than logging out and in again later. With su, you permanently drop to a superuser shell which must be exited using exit or logout. Sudo makes it easier to perform a single command with superuser privileges. And lastly, if there is a security breach it can in some cases leave a better audit trail showing which user account was compromised. You can even choose which commands a user is allowed to perform using sudo and which commands are forbidden for that user. If you have multiple users, you can revoke one's superuser access just by removing their sudo permission, without needing to change the root password and notify everyone of a new password. There is no need for them to remember a root password, as they use their own password. With sudo, you choose in advance which users have sudo access. You will see this usage of sudo pretty much anywhere you read a tutorial about Ubuntu on the web. For instance, to run apt-get dist-upgrade as a superuser, you could use: sudo apt-get dist-upgrade In a default Ubuntu install the person who installed the OS is given "sudo" permission by default.Īnybody with full "sudo" permission may perform something "as a superuser" by pre-pending sudo to their command. Instead, a default Ubuntu install will use sudo to give superuser privileges. Ubuntu chose not to give a root login and password by default for a reason. While you can create a password for the superuser account allowing you to log in as root with su, it's worth mentioning that this isn't the usual way of doing things with Ubuntu (or increasingly, other distributions as well).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |