You are not logged in.

#1 2015-08-28 23:42:03

enzyme
Member
Registered: 2015-08-08
Posts: 44

pacman without sudo (solved)

ive seen several tutz on youtube of people using the pacman command without using the sudo command. Can someone please explain to me how i can set my system up to do this?

Last edited by enzyme (2015-08-29 03:13:54)

Offline

#2 2015-08-29 00:19:25

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: pacman without sudo (solved)

Enabling a regular user to run pacman without any authentication is a security risk but hey, it's your system to compromise or break as you see fit.

There are 2 ways. I mentioned one in my reply to your other thread:

Xyne wrote:

If you want to regularly run certain commands through sudo, create aliases in your Bash configuration file (or whatever shell you use).

Given that sudo has a validity window, most tutorial vids likely use a sudo alias with a password but omit the first authentication. I would recommend using something other than "pacman" as your alias though, so that you can still run other operations such as -Q without escalated privileges.

If you really don't want to have to enter a password ever, you can configure your sudoers file to allow your user to run the command without it. Follow the wiki.

The other way to do it would be to log in as root.

Not a Pacman issue. Moving to newbie corner...


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2015-08-29 00:30:55

enzyme
Member
Registered: 2015-08-08
Posts: 44

Re: pacman without sudo (solved)

Xyne wrote:

Enabling a regular user to run pacman without any authentication is a security risk but hey, it's your system to compromise or break as you see fit.

yeah i am really new at this and i am doing my best to try and learn it on my own. and i really appreciate your input but really could do without the sarcasm. It isnt going to make me understand any faster. Now im assuming if i use the "su" command this will give me root privilege so as not to harm my system?

Offline

#4 2015-08-29 00:38:09

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: pacman without sudo (solved)

It is not sarcasm.  It is a serious problem, but we are continually plagued by members who insist on running as root.  We don't even argue with them anymore.  I just ignore them.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2015-08-29 00:41:46

enzyme
Member
Registered: 2015-08-08
Posts: 44

Re: pacman without sudo (solved)

ewaller wrote:

It is not sarcasm.  It is a serious problem, but we are continually plagued by members who insist on running as root.  We don't even argue with them anymore.  I just ignore them.

i can see how that would be annoying, and thats all it would have taken was a simple explanation, now i understand that it is unsafe to run as root. so ill just keep using the sudo command. that was simple enough thank you.

Offline

#6 2015-08-29 01:05:23

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: pacman without sudo (solved)

As ewaller correctly surmised, it wasn't sarcasm. I honestly think it's a bad idea but I'm not going to withhold information to stop you.

Given your question about "su" and your remark about being "really new at this", I'm guessing that you're coming from Windows where (at least on older versions) almost everyone always runs as administrator. Linux doesn't do this. Normally you have a user named root with administrator privileges that you only use to do system stuff (and never for things like browsing, running GUIs, etc.) and a regular user for your day-to-day stuff (browsing, music, games, work, etc.).

Using su will let you switch to the root user. If you make a mistake, you can break the entire system as root (e.g. by deleting the wrong file, running malware, installing something). Once you're root, you can do just about anything, but it's a bad idea to do anything beyond what is absolutely necessary as root. That's the whole point of "sudo". It lets a regular user easily run a few specific commands with root privileges without having to log in as root, usually with authentication to make sure only the real user does so, and on purpose.

So, recapping, an alias such as

alias spac='/usr/bin/sudo /usr/bin/pacman'

will let you run "pacman" as root just by typing "spac", after you've configured the sudoers file to allow your user to do so. I recommend doing that and leaving the password prompt. You could also skip the password prompt through sudoers, but that's a somewhat bad idea. You could also just log in as root to run pacman, but that requires a password entry as well. If you only do that to run pacman, it's not a bad idea. The final option would be to just run as root the whole time, but that would be a horrible idea.

Please read up on the following:

  • root vs normal user privileges

  • su vs sudo

  • bash aliases

I understand that this is new to you, but Arch users are expected to make an effort to figure things out before asking others, especially for "the basics". It's more about attitude than knowledge. If you feel that this is unreasonable, please read the Community Ethos link in my signature along with this post about help vampires.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#7 2015-08-29 03:13:35

enzyme
Member
Registered: 2015-08-08
Posts: 44

Re: pacman without sudo (solved)

Xyne wrote:

As ewaller correctly surmised, it wasn't sarcasm. I honestly think it's a bad idea but I'm not going to withhold information to stop you.

Given your question about "su" and your remark about being "really new at this", I'm guessing that you're coming from Windows where (at least on older versions) almost everyone always runs as administrator. Linux doesn't do this. Normally you have a user named root with administrator privileges that you only use to do system stuff (and never for things like browsing, running GUIs, etc.) and a regular user for your day-to-day stuff (browsing, music, games, work, etc.).

Using su will let you switch to the root user. If you make a mistake, you can break the entire system as root (e.g. by deleting the wrong file, running malware, installing something). Once you're root, you can do just about anything, but it's a bad idea to do anything beyond what is absolutely necessary as root. That's the whole point of "sudo". It lets a regular user easily run a few specific commands with root privileges without having to log in as root, usually with authentication to make sure only the real user does so, and on purpose.

So, recapping, an alias such as

alias spac='/usr/bin/sudo /usr/bin/pacman'

will let you run "pacman" as root just by typing "spac", after you've configured the sudoers file to allow your user to do so. I recommend doing that and leaving the password prompt. You could also skip the password prompt through sudoers, but that's a somewhat bad idea. You could also just log in as root to run pacman, but that requires a password entry as well. If you only do that to run pacman, it's not a bad idea. The final option would be to just run as root the whole time, but that would be a horrible idea.

Please read up on the following:

  • root vs normal user privileges

  • su vs sudo

  • bash aliases

I understand that this is new to you, but Arch users are expected to make an effort to figure things out before asking others, especially for "the basics". It's more about attitude than knowledge. If you feel that this is unreasonable, please read the Community Ethos link in my signature along with this post about help vampires.

after reading this it kinda hit me like a two ton heavy thing. this is exactly what makes linux more secure in the first place. and here i am trying to open up pandoras' box. i think ill just leave it alone for now i might eventually add the alias but i think i might need to mess around with everything a bit more, sort of have a better understanding of everything before i start changing stuff around thank you for everything i really appreciate all your input.

Offline

#8 2015-08-29 03:29:46

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: pacman without sudo (solved)

enzyme wrote:

after reading this it kinda hit me like a two ton heavy thing. this is exactly what makes linux more secure in the first place. and here i am trying to open up pandoras' box. i think ill just leave it alone for now i might eventually add the alias but i think i might need to mess around with everything a bit more, sort of have a better understanding of everything before i start changing stuff around thank you for everything i really appreciate all your input.

You're welcome. smile

Messing around with everything is a good way to learn. You'll inevitably break things but you'll come to understand them when you try to fix them. Security isn't the only thing that Linux does differently so there should be a lot to explore, but that's part of the fun, especially with Arch and all of its options.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB