Sudo port Password login
Kevin Reid
kpreid at switchb.org
Fri Apr 3 14:45:23 UTC 2020
On Fri, Apr 3, 2020 at 6:59 AM Hans Fredrik Johansson <
fjohansson1212 at gmail.com> wrote:
> But when I type « sudo port selfupdate » they ask for my password:
> Password:
>
> I tried my login password (for fjhome account) and got the answer:
> fjhome is not in the sudoers file. This incident will be reported.
>
This does not work because, as you guessed, this user is not admin. Only
admin can use sudo with their own password to become root.
If I try the password for the admin I get :
> Sorry, try again.
>
This doesn't work because sudo doesn't accept any account's password, only
the current one's.
if I log my self as « su - admin » and tape again « port version » I get:
> -bash: port: command not found
>
This doesn't work because the MacPorts installer added the location of the
'port' command to the PATH set up in the .bash_profile file for the account
you ran it as but not any other account. 'sudo' transfers over your $PATH
but 'su' does not. Also, if it had found the port command, you would have
gotten the "Insufficient privileges" error because MacPorts is not running
as root.
Here is what you need to do: first, "su admin" so that you are using the
admin account. Then, use both sudo and the full path to the port command:
"sudo /opt/local/bin/port selfupdate".
In order to avoid needing to use the full path in the future, find the
section in your .bash_profile file (actually, I don't know how this works
if your login shell is zsh...) which MacPorts added that looks like this:
# MacPorts Installer addition on 2016-02-04_at_14:31:04: adding an
appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
and copy it into the same file for your admin account. Then "sudo port
selfupdate" will work when run from the admin account.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20200403/09520d66/attachment.html>
More information about the macports-users
mailing list