sudo vs su philosophy for Calculate/Gentoo?

Hi Calculaters,

I have only been using Linux for 2 years now.

Whilst solving the problems I encountered with the use of sudo I did some searching and I discovered the following 2 pages which I hope will be useful to other less experienced Users.

http://www.howtogeek.com/111479/htg-explains-whats-the-difference-between-sudo-su/

https://www.garron.me/en/linux/visudo-command-sudoers-file-sudo-default-editor.html

All of the distributions I have used or tested, so far, if I recall correctly, have had the use of sudo enabled for the User account that is created when the operating system is installed. So, I was not aware that this is not the case for all distributions of Linux.

I have seen su mentioned in the past but maybe there was not enough detail provided to prompt me to further investigate the use of it and hence I did not have the knowledge to know that I could use it to achieve the same things I was accustomed to doing with sudo.

What is the philosophy followed by Calculate/Gentoo with regards to sudo and su?

Thanks, MTB.

In Calculate Linux sudo is configured in Live USB. Once installed, you can get the right ‘root’ from the user using the ‘su’. To do this the user must belong to a group ‘wheel’. This is done for the default user ‘guest’.

Hi Alexander,

I understand what you posted above but you have not explained the philosophy behind it.

Does Calculate and/or Gentoo do things in this way for a specific reason?

Is it done this way for reasons of security?

What are the advantages (pros) and disadvantages (cons) of configuring sudo the way that it has been done in Calculate?

Thanks, Michael.

Sorry, it’s difficult to explain the philosophy of the language, which is not my mother. Unfortunately, I had to use google translator.

If you wish, you can set up ‘sudo’ yourself. If you can not configure sudo, then open full access via sudo is wrong and dangerous :slight_smile:

Hi Alexander,

I have added my User account to the /etc/sudoers file as follows.

My_User_Account ALL=(ALL) ALL

Is this correct or is this still wrong and dangerous?

If you suggest that it is still wrong and dangerous, then, I can do some more research to understand why.

Thanks, Michael.

I would say for a home system with you being the only admin, acting as user and admin My_User_Account ALL=(ALL) ALL is OK but like Alexander stated its not all that safe here are my reasons why.

ALL=(ALL) ALL:
Allowed the user access to everything, unrestricted elevated privileges. The main point for adding users or groups to the sudoers file is to give elevated privileges to that user/group for certain areas on the system. Like say if I were a dev team lead where all the devs under we worked off of one sever:

/home
/home/dev/
/home/dev/leadDeveloper
/home/dev/developer0
/home/dev/developer1
/home/dev/developer2
/home/dev/developer3
/home/dev/developer4

Well the admin would add me to the sudoers file with elevated privileges to /home/dev/ not to the rest of the system only /home/dev/ so I can have access to all of the home directories of the devs on my team.

Adding
leadDeveloper ALL=(ALL) ALL gives me access to the whole system [I would love this if our admins did this :-)].

Back to what I stated above I personally have My_User_Account ALL=(ALL) ALL [on my home system], its just me as a user and the admin.

When it comes to philosophy, in my opinion there isn’t one there is just a set of best practices. In general you want to preform commands with ‘sudo’ that way you don’t loose your history of who changed what, and you don’t end up with root owning everything [although its easy to chown back to your user if you need to].

A few things I would never do as root ‘su’ [just my opinion here]:

  • Compile software as root. Especially run GCC as root. I don’t/can’t remember recent reasons not to do this I just have bad memories dealing with permissions and mangled software I compiled as root.
  • Install software as root. Things like git come to mind. The last thing you want to do is install something and root be the only user that can use the application.

Other than that I think its just personal preference. To me, typing ‘sudo’ makes me think about the command that is going to follow next. But your mileage may vary.

[[http://www.differencebetween.net/technology/difference-between-su-and-sudo/]]

Just my two cents. Please correct any incorrect portions of my post.