How to not have to type sudo but still stay current user?

I want to be able to execute root commands without needing to type sudo, but I don’t want to change user so that I can still for example be able to do “cd ~” to go to where I have been doing work and have aliases.

How can I do this?

Answer

Sounds like you want a “sudo su” shell. You run “su” through sudo, then your euid is 0 but you still have the environment from your non-root ID. Although honestly, you probably want to re-think why you’re having to run root commands when doing what I assume is non-root work in the first place…

Attribution
Source : Link , Question Author : Edwin Evans , Answer Author : John

Leave a Comment