How to run pkg_xxx

Do the pkg_xxx applications have to be run under 'root'? I tried pkg_add mod_perl2 under my user name and got all sorts of complaints, but under root all seems to have worked. What if a user is not able to get to 'root', how does one get to try a port? Is there anything in the distribution to give an indication?
 
In general, yes. Things that make changes to the system require root privileges to prevent unauthorized changes.
 
You could also use sudo to use root's privileges for pkg_* stuff. You may set up /etc/sudoers to only allow /usr/sbin/pkg_* for only certain users, if you don't like the idea of giving full root access to those users.

Of course, if you're not an admin of the system and the admin doesn't want you to be able to run pkg_* tools, then you're out of luck.
 
You can create a special user and/or group that will be able to install applications using pkg_add and/or ports. In order to do that you'll have to give special permissions to the folders that ports are built (or change the ports' build directory, configure directory, etc. see man ports). Then you should change the permissions on the folders you want ports to be installed in (/usr/local/bin, /usr/local/etc, /usr/local/lib, etc) so that your special user and/or group will be able to have write privileges in there. Your special user and/or group should be able to update ldconfig too. I must be missing a few steps more steps, and once these are also completed you'll be able to have your requested functionality.

Why don't you use su - or sudo instead, as the rest of the guys suggest? It just takes a few clicks :).
 
Back
Top