LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   Configuring User Permissions for Applications (https://www.linuxquestions.org/questions/mandriva-30/configuring-user-permissions-for-applications-717963/)

Completely Clueless 04-09-2009 10:10 AM

Configuring User Permissions for Applications
 
Hi Guys,

This query is actually in relation to PCLinuxOS, but since it's based on Mandriva and there's no PCLOS sub-forum yet....

I've just done a complete reinstallation, after having been told elsewhere that I was nuts for browsing the web in root mode. The problem was so many applications are by default off-limits to ordinary users and it was just a quick and dirty shortcut to log in as root instead. But anyway, I've put that bad habit behind me. Now, where do I find the settings to give a regular user access to applications? I've never come across a distro with so many readily available configuration options it really is quite baffling. This is the latest release, PCLinuxOS 2009.1

Thanks, cc.

ernie 04-09-2009 12:55 PM

If I want / need to adjust permissions for executable files here (Mandriva 2009.0 w. KDE-4.2.2) I open a terminal window as root, run konqueror (konqueror -profile "File Management") as a file manager, navigate to the applications I want to adjust, and fix the permissions manually.

This can be a long and tedious process if done on many files (one at a time), so if you want to fix the permissions for all applications in (for example) /usr/bin, you would be best served to open a terminal window (as root), then run the following command (Note:I have not tried this myself):
Code:

chmod +x /usr/bin/*
Note: After running this command, check that file permissions have changed to allow all users to execute the files:
Code:

ls -al
FIle permissions are reported in three sets - user, group, world. If a file is writable by the user, readable and executable by the group and the world, its permissions would be reported as:
Code:

-rwxr-xr-x 1 root root 20504 2008-09-07 16:29 xscreensaver-command*
HTH,

tkedwards 04-16-2009 04:35 AM

Sorry but neither the original question or the answer make sense to me. By default on any Linux distro* an ordinary user has execute permissions on all programs in /usr/bin and /bin and almost all in the root-only commands directories /usr/sbin and /sbin. Edit: And just because a user has permission to execute a program doesn't mean the program will function right - most of the root-only commands will just error-out as they can't perform without being root.

*However* All the applications (web browser, office program, media player, games etc.) that a user needs to use can be run without root - it's not like Windows where programs often need to write to system directories like \Windows and \Program Files, any configuration changes or files created will be saved in the user's home directory, where they belong.

The few applications you'd ever need to run as root would be the Control Centre (which will prompt for the root password on startup), a text editor to edit config files or a file manager:
Code:

su -
kwrite # start a text editor
konqueror # start a file manager

(although only edit system config files or manager files as root if you know what you're doing)

* Unless PCLinuxOS has changed something fundamental

ernie 04-16-2009 03:28 PM

I am sorry if I confused any one. I was using /usr/bin for an example. All the files in that directory should (of course) be executable by all users. The terminal example was more for completeness than any thing. I should have added that the thread originator should look at man chmod for more information on its use.

tkedwards 04-16-2009 03:38 PM

Ok but the main point is still that changing the permissions is useless. Either an application or command is designed to be run as a non-privileged user (web browsers, office programs, media players, graphics editors etc. etc.) and should be run non-privileged; or it's a system administration function (Control Centre, editing config files, some commands) and should be run as root either with su - or sudo. The permissions are already setup and shouldn't be changed.

ernie 04-17-2009 01:30 AM

I have re-read your original inquiry, and there is a way you can run applications as root without logging in as the root user (well, as with all things Linux, there are actually a few ways). Open a terminal window, su to root, then execute the application from the root command line. If the program is a GUI application, a window will open, and the program will run with root authority. For most applications that require root authority, you should get a dialogue box requesting that you enter your root password when you start them. For a program such as KDE's System Settings application which is used to configure your user Desktop configurations (should be run with your user authority) as well as KDM (has to be run with root authority), you may want to edit the KDE menu to add a second entry, but with the Run as a different user check box in the Advanced tab checked, and root entered in the username text entry field. To run the KDE menu editor, ALT+Click the KDE Menu, then select Menu Editor in the resulting pop up list.

HTH,

tkedwards 04-17-2009 02:25 AM

Quote:

Open a terminal window, su to root, then execute the application from the root command line.
This won't work on most setups, it needs to be
Code:

su -
and I already posted this 4 posts ago! :scratch:

ernie 04-17-2009 05:22 AM

tksedwards,
Since I am so stupid that I did not see your earlier post (where you "already said that 4 posts ago"), I'll remove myself from the equation so as to not further confuse the issue.

tkedwards 04-17-2009 05:33 AM

Why get offended? It's the most basic common sense on msg boards to read the thread before you reply, as it's annoying for others when you don't.

Crito 04-21-2009 10:33 PM

su with a dash loads root's $PATH environment variable. You could add /sbin to your user's $PATH if that's the only problem, or you could setuid root the executable but that's not usually recommended for security reasons.

GlennsPref 05-01-2009 12:45 AM

Hi, I have another way to get around permissions for frequently used admin programs.

In stead of bash, I use zsh shell, where I can configure alias commands...like,

urpmi the alias = sudo urpmi --noclean

Code:

alias cat='sudo cat'
alias locate='sudo locate'
alias lsusb -v='sudo lsusb -v'
alias lsusb='sudo lsusb'
alias lsmod='sudo lsmod'
alias lspci -v='sudo lspci -v'
alias lspci='sudo lspci'
alias fw-reset='sudo fw-reset'
alias service='sudo service'
alias netstat='sudo netstat'
alias fslint='sudo ~/bin/fslint'
alias smart='sudo smart'
alias ifup='sudo ifup'
alias ifdown='sudo ifdown'
alias ifconfig='sudo ifconfig'
alias updatedb='sudo updatedb'
alias rpm='sudo rpm'
alias urpmi.update='sudo urpmi.update'
alias urpmi='sudo urpmi --noclean'
alias urpme='sudo urpme'

to name a few...

Using this method you also need to setup sudo and then "make the user a member of the wheel group".
sample sudoers file...
Quote:

#
# Sample /etc/sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

##
# User alias specification
##
User_Alias FULLTIMERS = millert, mikef, dowdy
User_Alias PARTTIMERS = bostley, jwfox, crawl
User_Alias WEBMASTERS = will, wendy, wim


##
# Override built-in defaults
##
Defaults syslog=auth
Defaults>root !set_logname
Defaults:FULLTIMERS !lecture
Defaults:millert !authenticate
Defaults@SERVERS log_year, logfile=/var/log/sudo.log

##
# User specification
##

# root and users in group wheel can run anything on any machine as any user
root ALL = (ALL) ALL
%wheel ALL = (ALL) ALL

# full time sysadmins can run anything on any machine without a password
FULLTIMERS ALL = NOPASSWD: ALL

# part time sysadmins may run anything but need a password
PARTTIMERS ALL = ALL
.............................................................
..............................................edit for space, see /etc/sudoers "carefullly!"
# users in the WEBMASTERS User_Alias (will, wendy, and wim)
# may run any command as user www (which owns the web pages)
# or simply su to www.
WEBMASTERS www = (www) ALL, (root) /usr/bin/su www

# anyone can mount/unmount a cd-rom on the machines in the CDROM alias
ALL CDROM = NOPASSWD: /sbin/umount /CDROM,\
/sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM



cheers, Glenn


All times are GMT -5. The time now is 07:56 PM.