Giving user or application permissions.

Hi

Im new on openSUSE so bear with me!

After successfully installing and starting XAMPP Im a bit stumped now. Im using geany for PHP and want to be able to save my files directly into:

/opt/lampp/htdocs

but I dont have the permissions on my user so Ive been using su to move them using the terminal which is a pain since geany then cant find the files!

How can I grant these permissions to my user?

Cheers

edit sudoers file, adding yourself copy-past permissions
that should solve it…

Or, add your user to the group which owns /opt/lampp/htdocs. Eg:

ls -las /opt/lampp/
htdocs **drwxrwxr**-- root www-data

root is the owner, www-data is the group.
root has permissions rwx (read,write,execute)
www-data has rwx also
other (anyone else) has r-- (read, no write, no execute)
Ignore the ‘d’ - it means directory

Assuming that the group www-data has write permissions, add your user to the www-data group. To see your groups, do this:

id user

Replace user with your user name.

To add your user to a group do this

gpasswd -a user group

Replace user and group with the appropriate user & group names

Ok I ran ls with this result.

ls -las /opt/lampp

total 168
4 drwxr-xr-x 18 root root 4096 May 25 12:03 .
4 drwxr-xr-x 3 root root 4096 May 25 11:36 …
12 drwxr-xr-x 2 root root 12288 Sep 19 2011 bin
4 drwxr-xr-x 2 root root 4096 Jul 14 2004 cgi-bin
4 drwxr-xr-x 3 root root 4096 Apr 13 2009 error
4 drwxr-xr-x 8 root root 4096 Sep 19 2011 etc
4 drwxr-xr-x 4 nobody root 4096 May 25 12:14 htdocs
4 drwxr-xr-x 3 root root 4096 May 31 2003 icons
16 -rwxr-xr-x 1 root root 15325 Sep 2 2011 lampp
12 drwxr-xr-x 15 root root 12288 Sep 19 2011 lib
4 drwxr-xr-x 2 root root 4096 Apr 26 2006 libexec
4 drwxr-xr-x 36 root root 4096 Aug 24 2009 licenses
4 drwxr-xr-x 2 root root 4096 May 25 11:38 logs
4 drwxr-xr-x 2 root root 4096 Sep 19 2011 modules
4 drwxr-xr-x 10 root root 4096 Sep 16 2011 phpmyadmin
64 -rw-rw-r-- 1 root root 65212 Sep 19 2011 RELEASENOTES
4 drwxr-xr-x 2 root root 4096 Sep 19 2011 sbin
4 drwxr-xr-x 39 root root 4096 Sep 19 2011 share
4 drwxr-xr-x 3 root root 4096 Jan 18 2005 tmp
4 drwxr-xr-x 6 root root 4096 May 25 11:38 var

Which is the group and which is the owner?

Cheers

Ok cheers, I understand now.

Only thing is “nobody” is the owner and root is the group. It would be bad practice to add my user to the root group would it not? How would I change the owner of /opt/lampp/?

…Linux has a steep learning curve!

yes thats not the best idea :slight_smile:

you can recursively change the owner for all files and folders inside that directory to you as another user . Lets set the owner of the files and folders to “lkzp"
chown -R lkzp *

OR
using visudo command as ROOT user navigate to :

User privilege specification

and add yourself example:
lkzp ALL = NOPASSWD: /sbin/copy,

that will give you rights to copy files within all directories…

Done!

Thanks for the help.

Good to hear that!

Good Luck lkzp

On Wed, 25 Apr 2012 22:06:03 +0530, lkzp <lkzp@no-mx.forums.opensuse.org>
wrote:

>
> Done!
>
> Thanks for the help.
>

i’m glad you got your problem solved and hope things will keep working for
you.

but for the benefit of others who may arrive at this thread via forum or
google search, i’d like to add that this is not the generally prefered way
to install apache, PHP, and MySQL on openSUSE.

unlike under windows, web and database services are an integrated part of
most or even all linux operating systems, and you do not have to install
them from a separate source like XAMPP.

in your standard repositories you find the apache web server, PHP, and
MySQL database server & client. if installed from these repos, they’ll get
updated automatically when security patches become available (via the
update repo), and there are special repos available that provide newer
versions of these services if desired. this sometimes leads to
difficulties, per example when you want to install a particular version of
apache or PHP which are not part of the openSUSE repos anymore. in this
case it may be useful to use an external source like XAMPP.

installing web services via openSUSE repos also gives you access to YAST
configuration tools that make it easier to configure these services –
even though i always find it easier to edit the services’ configuration
files, since i’m used to this approach from long ago.

in general i wouldn’t recommend to install apache/PHP/MySQL via XAMPP, but
from the standard openSUSE repos. in your case, since you got your
installation working it appears, you should probably continue the way
you’re going, until or unless you meet problems on the way.

instructions on how to install & configure web services in openSUSE are
available in these forums, but i must admit i’m too lazy to go looking for
them now…


phani.

On 2012-04-25 16:56, lkzp wrote:

> Which is the group and which is the owner?


owner    group
/       /
> 4 drwxr-xr-x  6 root   root  4096 May 25 11:38 var
|      ---
|   ---   \ "other" users permissions.
|---   \ group permissions
|   \ owner permissions
\ type of file



Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Glad you got it sorted, I’m a little wary of the whole “give yourself permission to copy files anywhere” but in the end it is your computer so just be careful :slight_smile:

If you wanted to do it how I suggested, I would do this:

#su - (to root, as you need permission)
#groupadd www-data (create a new group)
#chgrp -R www-data /opt/lampp/htdocs (chnage the group of the directory you're after)
#chmod -R g+w /opt/lampp/htdocs (allow group members to write in here)
#gpasswd -a <your user> www-data (add yourself to the www-data group)

Log out & then in, voila.