I am trying to setup my webserver so that one group will have access to the files. Apache and every user that needs to edit the files will be part of this group. So I've set all the files to have the group psacln. I've added psacln to my groups. But it still won't let me view the files:
[tom#166 httpdocs]$ whoami
tom
[tom#166 httpdocs]$ groups tom
tom : tom adm wheel apache psacln andy
[tom#166 httpdocs]$ ls -al
ls: .: Permission denied
[tom#166 httpdocs]$ sudo ls -al
total 92
d---rwx--- 14 andy psacln 4096 Jul 22 17:51 .
drwxrwxr-x 16 apache apache 4096 Jul 21 09:29 ..
d---rwx--- 4 andy psacln 4096 Jul 21 09:26 backend
d---rwx--- 3 andy psacln 4096 Jul 22 15:21 core
d---rwx--- 5 andy psacln 4096 Jul 21 09:26 css
...
One thing that may be useful to note, is that when you change a user's group membership, you will have to log out and back in again (i.e. group memberships will take effect when you log in and don't normally change otherwise).
You can either log in and out to let the group change take effect, or changing your "active" group with the newgrp command will also do this for you.
Related
In Linux, I am the owner of a file, then I tried to change owner to another account, failed. Operation not permitted. Do you know why ? I am the user 'BBB'. Thanks
-bash-4.1$ ls -al
drwxrwxrwx 2 AAA games 4096 Nov 23 14:39 .
drwxr-xr-x 3 AAA games 4096 Nov 23 14:36 ..
-rw-r--r-- 1 BBB esmgroup 16798 Nov 23 14:38 XXX-1.0-SNAPSHOT.jar
-bash-4.1$ chown AAA:games ./*.jar
chown: changing ownership of `./XXX-1.0-SNAPSHOT.jar': Operation not permitted
Only root can change the owner on the file. That's final.
You can do that by login to root using su or use sudo before your command.
More information here: https://unix.stackexchange.com/questions/27350/why-cant-a-normal-user-chown-a-file
You can change the file's group if you're in more than one group.
You should login to root account to be granted to change ownership to any user
You can type sudo before the command and then login to your root user
I was able to connect to my school server via SSH. I had an assignment in which I was supposed to use the touch command to create a new file. Yet it keeps returning permission denied. Others were able to do the same thing. Though why do I keep getting this error?
Below is what was the input from the terminal.
Last login: Tue Aug 23 09:16:18 on ttys000
Dominiks-Air:~ fsociety95$ ssh djaneka1#navajo.dtcc.edu
djaneka1#navajo.dtcc.edu's password:
Last login: Tue Aug 23 09:16:35 2016 from pool-72-94-210-193.phlapa.fios.verizon.net
Navajo is Linux shell server provided to staff, faculty, and students. The
operating system is RedHat Enterprise Linux 5.
Alpine, a Pine replacement, has been provided as a mail client. Run "pine"
at the command prompt.
This server also provides web space to users. Web pages can be stored in
the ~/www directory. This is also accessible by mapping a drive in Windows
to \navajo\homepage. The URL for your homepage is
http://user.dtcc.edu/~username/.
Your home directory is also accessible in Windows by mapping to
\navajo\.
If something appears broken or missing, please email path#dtcc.edu.
Could not chdir to home directory /u/d/j/djaneka1: No such file or directory
-bash-3.2$ touch today
touch: cannot touch `today': Permission denied
-bash-3.2$ pwd
/
-bash-3.2$ touch today
touch: cannot touch `today': Permission denied
-bash-3.2$
Edit: here is the result of ls -al
-bash-3.2$ ls -al
total 204
drwxr-xr-x 25 root root 4096 Aug 22 16:50 .
drwxr-xr-x 25 root root 4096 Aug 22 16:50 ..
-rw-r--r-- 1 root root 0 Aug 3 14:01 .autofsck
-rw-r--r-- 1 root root 0 Jan 30 2009 .autorelabel
-rw------- 1 root root 2050 Aug 3 14:00 .bash_history
drwxr-xr-x 2 root root 4096 May 4 04:14 bin
drwxr-xr-x 4 root root 3072 Aug 3 13:57 boot
drwxr-xr-x 11 root root 4060 Aug 3 14:02 dev
drwxr-xr-x 87 root root 12288 Aug 23 10:05 etc
drwxr-xr-x 3 root root 4096 Oct 1 2009 home
drwxr-xr-x 13 root root 12288 Jun 1 04:09 lib
drwx------ 2 root root 16384 Mar 24 2008 lost+found
drwxr-xr-x 3 root root 4096 Oct 1 2009 media
drwxr-xr-x 2 root root 0 Aug 3 14:02 misc
drwxr-xr-x 4 root root 4096 May 26 2012 mnt
drwxr-xr-x 2 root root 0 Aug 3 14:02 net
drwxr-xr-x 9 root root 4096 Jan 5 2009 nsr
drwxrwxr-x 3 root root 4096 Oct 12 2015 opt
dr-xr-xr-x 219 root root 0 Aug 3 14:01 proc
drwxr-x--- 12 root root 4096 Apr 22 10:06 root
drwxr-xr-x 2 root root 12288 Aug 4 04:02 sbin
drwxr-xr-x 2 root root 4096 Oct 1 2009 selinux
drwxr-xr-x 2 root root 4096 Oct 1 2009 srv
drwxr-xr-x 11 root root 0 Aug 3 14:01 sys
drwxrwxrwt 38 root root 4096 Aug 23 10:07 tmp
drwxr-xr-x 34 root root 4096 Jun 21 08:29 u
drwxr-xr-x 14 root root 4096 Apr 16 2010 usr
drwxr-xr-x 24 root root 4096 Apr 16 2010 var
-rw------- 1 root root 2865 Dec 16 2008 .viminfo
-bash-3.2$
EDIT:
Here is what I see after trying touch today in /home
So to try and create a new document in the root directory you need to be recognised as root. That means using the sudo command.
However for that you would need a password that you may not have. If you do perfect. But in any case I would not recommend adding files to the root directory.
Instead try the following:
cd home
touch today
This should work just fine and answer your question.
Still if you need/want to create today in your root directory try the following
sudo touch today
You will then be prompted for the root password that you can type (if you have it obviously)
In any case I suggest reading this which may be very helpful for you.
I wonder if this was ever truly answered.
If I was looking at it, I would try to see what the system thinks is the home directory of djaneka1, since it may have been setup partway and not completed, leaving stuff owned by root that should have been owned by djaneka1.
If you use the pwd command, and get back the "/" (root) directory there is something wrong with your setup.
The message: Could not chdir to home directory /u/d/j/djaneka1: No such file or directory
tells you it can't find your home directory.
-bash-3.2$ pwd
/
the command "pwd" revealing "/" is just an artifact of the system not being able to find your home directory.
To find what the system thinks is one's home directory,
one can search the file named '/etc/passwd' for one's login name.
I expect this is a possible result if you do that:
$ fgrep 'djaneka1' /etc/passwd
djaneka1:x:1505:1506::/u/d/j/djaneka1:/bin/bash
since it complained that it couldn't find that directory.
This needs to be fixed by someone who has more rights to the system, like root.
there is nothing djaneka1 can do a
I am currently creating an application that requires separate users running duplicate programs. They cannot run under root because of security reasons, so they are initiated by a Java app that I am working on, and I am starting them with runuser -l. However, I cannot cd into a directory, even though it is owned by the user, and the user has 770 permissions in the folder.
Here's what I'm running:
runuser -l lp1 -c 'java \-jar /root/Desktop/workspace/LitePanel/servers/server1/server.jar \-Xms1024M nogui'
And the output of this is:
runuser: warning: cannot change directory to /root/Desktop/workspace/LitePanel/bin/servers/server1/: Permission denied
Here's an ls -all:
drwxr-xr-x. 3 root root 4096 Jan 30 14:03 .
drwxr-xr-x. 7 root root 4096 Jan 30 14:02 ..
drwxrwx---. 2 lp1 lp1 4096 Jan 31 03:07 server1
Inside the directory:
drwxrwx---. 2 lp1 lp1 4096 Jan 31 03:07 .
drwxr-xr-x. 3 root root 4096 Jan 30 14:03 ..
-rwxrwx---. 1 lp1 lp1 9170551 Jan 31 03:07 server.jar
And here's /etc/passwd:
lp1:x:501:501::/root/Desktop/workspace/LitePanel/bin/servers/server1/:/bin/false
Anyone know why this is happening? It looks like the user has the necessary permissions to do this.
You have said that the directory itself has permissions 770 and is owned by the user, but what about its parents? I believe the cd command will need at least read access (and possibly execute) on the parent directories.
I'm using NFSv4 and used following /etc/exports on Server (lets say, xx.xx.xx.x0):
/var/www/html/project xx.xx.xx.x101(rw)
/var/www/html/project xx.xx.xx.x102(rw)
And each Client is showing something like below, when i check mount:
xx.xx.xx.x0:/var/www/html/project on /var/www/html/project type nfs (rw,vers=4,addr=xx.xx.xx.x0,clientaddr=xx.xx.xx.x101)
But when i check into the mounted directory ls -laZ (with Z option), it is showing like:
drwxrwxrwx. 11 user1 user1 ? 4.0K Mar 9 02:36 .
drwxr-xr-x. 26 user1 user1 ? 4.0K Mar 8 18:17 ..
drwxrwxrwx. 9 user1 user1 ? 4.0K Sep 3 2012 wp-admin
drwxrwxrwx. 8 user1 user1 ? 4.0K Dec 12 09:47 wp-content
drwxrwxrwx. 8 user1 user1 ? 4.0K Oct 16 12:04 wp-includes
-rwxrwxr--. 1 user1 user1 ? 647 Mar 8 18:54 .htaccess
-rwxrwxr--. 1 user1 user1 ? 395 Dec 12 09:49 index.php
-rwxrwxrwx. 1 user1 user1 ? 20K Dec 12 09:49 license.txt
-rwxrwxrwx. 1 user1 user1 ? 9.0K Dec 12 09:49 readme.html
The problems are the ? Question Marks, which i believe is showing wrong File Security Context Values.
Any good idea on it please?
Note: SELinux is disabled, on every machines.
i got it by myself that i realized SELinux on Clients, was blocking the Security Context Permissions whilst NFS Server is totally disabling the SELinux. So i disable the SELinux on this Client machines and rebooted, then the exactly the same File/Directory Security Contexts are showing on all ends.
I've been trying to get Apache to follow symlinks. I am getting an "Access forbidden!" message.
I understand this is likely a permissions issue.
So far I have tried:
Setting the source directory to chmod 777
Adding the xampp/apache user 'nobody' to the groups 'admin' and 'staff'
Both symlink and apache alias directives (both give me the forbidden message)
Source:
1228833 drwxr-xr-x 27 eric staff 918 Jun 1 09:55 .
332009 drwxr-xr-x+ 40 eric staff 1360 May 22 10:41 ..
1228879 -rw-r--r--# 1 eric staff 24580 Jun 1 09:55 .DS_Store
30604402 lrwxr-xr-x 1 eric staff 93 Jun 1 09:07 YellowFinTunaPages -> /Users/ericmiller/Dropbox/_iSirona/iSirona Product Development/Prototypes/YellowFinTunaPages/
Destination:
30602721 drwxr-xr-x 4 eric staff 136 Jun 1 09:10 .
1286885 drwxr-xr-x# 11 eric staff 374 Jun 1 09:04 ..
30606068 -rw-r--r--# 1 eric staff 6148 Jun 1 09:10 .DS_Store
30602745 drwxrwxrwx 10 eric staff 340 Jun 1 09:05 YellowFinTunaPages
Turns out access permissions for a folder depend on the folder above it. I didn't realize this. I had to chmod 755 the whole preceding directory tree. I wish there were a better solution--I don't actually want to allow broad access to that whole tree, just the subfolder.
Apache won't follow symlinks (403 Forbidden)