This is a fairly simple problem to explain but it is really annoying me and I could do with some advice. How to I ensure that apache is user : group owner of a dir no matter who uploads to it..   the reason is that WinSCP is used to upload files to /usr/local/bin/builder and this sets the user to root and the group to root. Don't cry I am logging in as root on WinSCP because it is fine for my purposes. I am happy with it. I understand what I am doing by using it and it's my choice to use it. I have 100+ servers and I don't want to introduce too much complexity so I keep it to this: root logs in on WinSCP if you don't think/want/agree that's great but this question is not for you.   I then have to manually login on putty as root and # chown -R apache:apache /usr/local/bin/builder in order for apache to have the permissions it needs to this dir. Which apache must or it will cause great evil to befall the server, which will make me have to stop going out or get back into the car at the cinema when I get customers saying the message of doom has reappeared (and I don't go out enough).  Now.   How do I make it so that at all times chown -R apache:apache /usr/local/bin/builder is true? the only way I feel I can do it is using  to imediately run a script but my heart says there must be a better way - I have also thought of maybe adding some sort of script within WinSCP but I have no idea how to do this and seems rather eventful. One last little addendum:   (PS: crontab-as-a-solution is a joke beyond epic proportions and I won't countenance it, it makes me cringe you considered it! shame on you!)
123789
I saw several threads about having issues with unexpected file permissions after file upload. I tried their solutions with no luck, I have to raise the problem in my way.   I run Nginx as nobody:nogroup on Debian 6. I changed the root web folder /usr/share/nginx/html to nobody:nogroup. Now I use WinSCP to upload file to the machine , but I use root account. If I create a new directory or update a new file, the ownership would be root:root. I am new to Linux world, I currently open a shell to change ownership of wwwroot after I have uploaded something to my server.   What is the best practice to upload file as root, but keep files and directories nobody:nogroup? Shall I set a password to account nobody and use this account to upload files?
30897
I am new to system administration and I have a permission related query. I have a group called administration. Inside the administration group, I have the users user1, user2, user3, superuser. All the users are in the administration group. Now, I need to give permissions to the user superuser to be able to view the /home directory of the other users. However, I do not want user1, user2, user3 to see the home of any other user other than himself. (That is, user1 should be able to see only user1's home and so on).   I have created the users and groups and assigned all the users to the group. How should I specify the permissions for the superuser now?   In other words, I'm thinking of having two groups (say NormalUsers and Superuser). The NormalUsers group will have the users user1, user2 and user3. The Superuser group will only have the user Superuser. Now, I need the Superuser to have full access on the files of users in the group NormalUsers. Is this possible in Linux?
5015
I changed permissions of a file (chmod g+w testfile) and running ls -l testfile gives:  -rwxrwxr-x 1 user1 user1 0 2011-01-24 20:36 testfile   I then added a user to that group ("/etc/group" has user1:x:1000:user2 line), but am failing to edit that file as user2. Why is this so?
91005
I am having an access problem to some files and directories that I have tracked down to the group assigned to access them.    When I manually change the name of the group in the properties/permissions menu for a directory from the default setting (MyGroup) to www-data used by my Drupal Website, the directory error messages I get are gone.    There are a large number of files and directories that require this change.  If believe using chmod will change the owner which is set correctly and being new to Ubuntu, I am reluctant to experiment without a better understanding of how owner and groups work in the permissions settings.   What command changes the Group setting for a directory?
94590
I thought .com is an ancient form for executable, leftover from early MS-DOS days? Why do they use that today in WinSCP? And why only for the CLI version?  I tried asking this in their chat room, but received not a single reply for days. As always.
16810
I would like the user to have full rights on this folder (as well as all sub-directories and files in it):  ~/.blabla   currently owned by root.  I have found numerous posts (in this forum and elsewhere) on how to do this for files but I can't find a way to do it for whole folders.
4716
[root@datacenteronline ~]# ssh root@192.168.1.172 Last login: Wed Apr 17 09:55:45 2013 from 192.168.1.187 [root@localhost ~]# ls /proc/ | grep 2266 [root@localhost ~]# cd /proc/2266 [root@localhost 2266]# ls attr             cpuset   limits      net            root       statm autogroup        cwd      loginuid    numa_maps      sched      status auxv             environ  maps        oom_adj        schedstat  syscall cgroup           exe      mem         oom_score      sessionid  task clear_refs       fd       mountinfo   oom_score_adj  smaps      wchan cmdline          fdinfo   mounts      pagemap        stack coredump_filter  io       mountstats  personality    stat [root@localhost 2266]# ls -al /proc/2266 total 0 dr-xr-xr-x   7 apache apache 0 Apr 17 09:45 . dr-xr-xr-x 266 root   root   0 Apr 17 09:11 .. dr-xr-xr-x   2 apache apache 0 Apr 17 09:45 attr -rw-r--r--   1 root   root   0 Apr 17 09:45 autogroup -r--------   1 root   root   0 Apr 17 09:45 auxv -r--r--r--   1 root   root   0 Apr 17 09:45 cgroup --w-------   1 root   root   0 Apr 17 09:45 clear_refs -r--r--r--   1 root   root   0 Apr 17 09:45 cmdline -rw-r--r--   1 root   root   0 Apr 17 09:45 coredump_filter -r--r--r--   1 root   root   0 Apr 17 09:45 cpuset lrwxrwxrwx   1 root   root   0 Apr 17 09:45 cwd -&gt; / -r--------   1 root   root   0 Apr 17 09:45 environ lrwxrwxrwx   1 root   root   0 Apr 17 09:45 exe -&gt; /usr/local/apache2/bin/httpd dr-x------   2 root   root   0 Apr 17 09:45 fd dr-x------   2 root   root   0 Apr 17 09:45 fdinfo -r--------   1 root   root   0 Apr 17 09:45 io -rw-------   1 root   root   0 Apr 17 09:45 limits -rw-r--r--   1 root   root   0 Apr 17 09:45 loginuid -r--r--r--   1 root   root   0 Apr 17 09:45 maps -rw-------   1 root   root   0 Apr 17 09:45 mem -r--r--r--   1 root   root   0 Apr 17 09:45 mountinfo -r--r--r--   1 root   root   0 Apr 17 09:45 mounts -r--------   1 root   root   0 Apr 17 09:45 mountstats dr-xr-xr-x   6 apache apache 0 Apr 17 09:45 net -r--r--r--   1 root   root   0 Apr 17 09:45 numa_maps -rw-r--r--   1 root   root   0 Apr 17 09:45 oom_adj -r--r--r--   1 root   root   0 Apr 17 09:45 oom_score -rw-r--r--   1 root   root   0 Apr 17 09:45 oom_score_adj -r--r--r--   1 root   root   0 Apr 17 09:45 pagemap -r--r--r--   1 root   root   0 Apr 17 09:45 personality lrwxrwxrwx   1 root   root   0 Apr 17 09:45 root -&gt; / -rw-r--r--   1 root   root   0 Apr 17 09:45 sched -r--r--r--   1 root   root   0 Apr 17 09:45 schedstat -r--r--r--   1 root   root   0 Apr 17 09:45 sessionid -r--r--r--   1 root   root   0 Apr 17 09:45 smaps -r--r--r--   1 root   root   0 Apr 17 09:45 stack -r--r--r--   1 root   root   0 Apr 17 09:45 stat -r--r--r--   1 root   root   0 Apr 17 09:45 statm -r--r--r--   1 root   root   0 Apr 17 09:45 status -r--r--r--   1 root   root   0 Apr 17 09:45 syscall dr-xr-xr-x  29 apache apache 0 Apr 17 09:45 task -r--r--r--   1 root   root   0 Apr 17 09:45 wchan   Cound anyone tell me what it is?
83132
I'm using WinSCP to access Unix computers. How can I change user after I have logged into a Unix server using WinSCP?  E.g. I have personal account in Unix computer A. I can log into this computer using PuTTY and then change user to root user  $sudo /usr/bin/su - rootuser   How can I do the same thing using WinSCP? I don't know the password for rootuser.
103095
I think I rather understand how file permissions work in Linux. However, I don't really understand why they are split into three levels and not into two.   I'd like the following issues answered:   Is this deliberate design or a patch? That is - was the owner/group permissions designed and created together with some rationale or did they come one after another to answer a need? Is there a scenario where the user/group/other scheme is useful but a group/other scheme will not suffice?   Answers to the first should quote either textbooks or official discussion boards.  Use cases I have considered are:   private files - very easily obtainable by making a group per-user, something that is often done as is in many systems. allowing only the owner (e.g. system service) to write to a file, allowing only a certain group to read, and deny all other access - the problem with this example is that once the requirement is for a group to have write access, the user/group/other fails with that. The answer for both is using ACLs, and doesn't justify, IMHO, the existence of owner permissions.   NB I have refined this question after having the question closed in .  EDIT corrected "but a group/owner scheme will not suffice" to "...group/other...".
49449
My user account on Windows 7 is part of the Administrators group which has a full control permissions on C:\inetpub\wwwroot:    However, when I try to create a folder in it, I get the "access denied" error. This is fixed by adding my specific user account to the list but that shouldn't be necessary should it?
25307
Sorry for the basic question - I'm a .NET developer and don't have much experience with LAMP setups.  I have a PHP site that will allow uploads to a specific folder. I have been told that this folder needs to be owned by the webserver user for the upload process to work, so I created the folder and then set permissions as such:  chown apache:apache -R uploads/ chmod 755 -R uploads/   The only problem now is that the FTP user can not modify the uploaded files at all.  Is there a permission setting that will allow me to still upload files and then modify them later as a user other than the webserver user?
87339
I've set up OpenSSH on various flavors of Linux tons of times.  But I can't for the life of me get it functioning correctly on windows.    There seem to be two sides to the issue.  The permissions and the key used by sshd/ssh-agent.  Permissions  Every page I read has a different answer for the correct permissions.  Some work, and sometimes the program complains about them.    From what I understand the keys should all be owned by SYSTEM, with read access for NT SERVICE\sshd and Full Control for Administrators and SYSTEM?  (As I understand SYSTEM and Administrators represent root in Windows).  I read in the documentation that the read access is only necessary if not using ssh-add/ssh-agent.  I also configured the same permissions for the %USERPROFILE%/.ssh/authorized_keys file and added the .pub the Ed25519 key which is the one I'm using to try and connect, though I've also tried it with my own generated RSA key.  With the permissions set this way the program doesn't complain when adding keys to the agent or running the daemon.  The only option I changed in sshd_config is the ListenAddress which was binding to 0.0.0.0, I set it to the machines local IP as SSH will only be used locally.    Keys  When I run sshd.exe with the -d option, I notice it importing the 4 default keys from %PROGRAMDATA%/ssh.  When I added the ed25519.pub key to authorized_keys it was followed by HOSTNAME@workstation@HOSTNAME, HOSTNAME being my PC's hostname.  Normally I would expected to see user@host.  I tried creating my own key and adding it but when I run sshd.exe -d it never seems to use anything other than the default keys.    In the end, I'm unable to connect to the OpenSSH server, and the logs in %PROGRAMDATA%/ssh/Logs only seem to show the server starting.  To sum up my questions: What are the correct permissions for the key files and authorized_hosts?  Does the annotation in authorized_keys being wrong make a difference?  Should I be adding all of the default keys .pub's into authorized_hosts?  And last, what does sshd mean when it mentions those keys during startup (see log)?  Shouldn't my own generated key just work as long as I add it to authorized_hosts?  debug1: sshd version OpenSSH_for_Windows_7.6, LibreSSL 2.6.4 debug1: private host key #0: ssh-rsa SHA256:and12LVkEqyXJ2gr0SxFEQObaSFF+Czlcnx2uFjZaJQ debug1: private host key #1: ssh-dss SHA256:waeLdy4Sm3NT+zbwEMIhbfl8TLe6WeQ0MuZE07CzFQU debug1: private host key #2: ecdsa-sha2-nistp256 SHA256:G8/7y/04cSE3EezTrcmpK4lRmJ5f5I/CDPcHaPzsv4o debug1: private host key #3: ssh-ed25519 SHA256:Jvn9UjsbdzH54L/yvGYGfCzJQVIMiIWL5RETbaL2ACA debug1: rexec_argv[0]='C:\\WINDOWS\\System32\\OpenSSH\\sshd.exe' debug1: rexec_argv[1]='-d' debug1: Bind to port 22 on 192.168.1.144. Server listening on 192.168.1.144 port 22.
80916
I know that some define permissions on the file system (such as www-data).  But I don't understand why  by adding a user to the "Video" group.  So the question is mainly what do all the pre-built groups do in Ubuntu?  More reasonably, since there are so many, what "special" groups exist and how or when should they be used?
118015
I am running Ubuntu 10.04 server and am having some very counter-intuitive experiences with users/groups. For example:  sudo touch test_file                    # create empty file  sudo groupadd test                      # create 'test' group  sudo chown root:test test_file          # change group of file to 'test'  sudo chmod g+rwx test_file              # give write permissions to group  sudo usermod -a -G test {my-user}       # add my user to 'test' group  touch test_file                         # touch the file as my current user   The last line produces a permissions error.    I have ensured that my user is part of the 'test' group (groups {my-user} confirms this).  The group of test_file is also definitely set to 'test' and the group permissions are set.   Why can't my user write to the file test file?
70869
I have a server setup where new linux users are created using (PHP)  shell_exec ( '/usr/sbin/useradd ' . $username ); exec ('usermod -a -G ' . $username . ' '. $username); #add user into the usergroup exec ('usermod -a -G ' . $username . ' www-data'); #add usergroup with the www-data   And then the user script changes the owner and group of the files to this owner. The server is setup with suPHP which then allows these files to be run as the owner.  This setup worked fine with Apache 2.2 but is breaking in Apache 2.4. Everything works fine except when I try to oepn the files, it gives a 403 forbidden error. Restarting apache after the user is added fixes the issue but that is not a viable solution for me. The users are added using a web server and hence I need to be able to do this without having to reload/restart apache everytime.  I have searched for serveral hours and tried to fix the issue but haven't been able to do so! I am running ubuntu 14.04 and I am not able to downgrade to apache 2.2 as well.
18198
Is there a simple way to restrict an SCP/SFTP user to a directory? All methods that I've come across require me to set a chroot jail up by copying binaries, but I don't think that should be necessary.
93918
I love Linux and everything she stands for; however, unfortunately I grew up with Windows. Thusly so I have learned very bad practices (such as NT Authority will protect me). I have several Linux VPS's for personal and educational uses and I manage all of them from the command line. Through the management of these servers I have learned very painful lessons of the power of the Root user. Such as:   rm -d -R /* chown www-user:www-user -R /* Etc.    I've only removed my root directory twice, but just last week I changed the permission of the whole drive - effectively locking the Root out.   Now I know that I should never be logged in as Root, but most of the time I have to deal with files that only the Root owns so I sudo and run the command.   So my question is, is there a way to prompt the user (who is root, or sudo'ed) when a potentially hazardous command is executed, so the user may rethink their decision? Possibly through scripts in Bash, or a different sudo wrapper.   Or (I ask this hopefully, and very simplified) is there a way to set up permissions where instead of a two tier user system (Root user, regular user) there is a three tier system like in Windows (NT Authority, Administrator, other User). Basically is there a way to keep the ability of System administration, but restrict access to some system files.