I've studied this topic https://help.ubuntu.com/community/FilePermissions for a while and can't get it work for some reason.
Particularly, these lines interest me the most:
To change all the permissions of each file and folder under a specified directory at once, use sudo chmod with -R
$ sudo chmod 777 -R /path/to/someDirectory $ ls -l total 3 -rwxrwxrwx 1 user user 0 Nov 19 20:13 file1 drwxrwxrwx 2 user user 4096 Nov 19 20:13 folder -rwxrwxrwx 1 user user 0 Nov 19 20:13 file2
Here's what I typed:
mark@ubuntuserver:~$ sudo chmod 755 /var/www/html
mark@ubuntuserver:~$ ls -l
total 0
Then I checked any changes in sftp:
sftp> cd /
sftp> cd var/www/html
sftp> pwd
Remote working directory: /var/www/html
sftp> ls -l
-rw-r--r-- 1 root root 11321 Apr 10 20:07 index.html
From the output it's clear that the html directory is still modifiable only by root.
How can I change this in the way that me (non-root) can upload files to the html directory ?
I also tested:
A file's owner can be changed using the chown command. For example, to change the foobar file's owner to tux:
$ sudo chown tux foobar
I typed from the server:
sudo chown mark owner
no effect.
sudo chown mark owner
what is that suppose to do? How come you introduce a file or dir called "owner" there? – Rinzwind Apr 14 '17 at 19:33sudo chown user:user mydocs
where the new owner and group isuser
and the directory you are taking ownership of ismydocs
– Gansheim Apr 14 '17 at 19:35sudo chmod 766 -r /var/www/html
– Gansheim Apr 14 '17 at 19:37ls -l
command from their home directory. @Mark Unless you are in the directory that you are trying to view/manipulate, you need to specify the path, in this case you should have issued the command asls -l /var/www/html
– Gansheim Apr 14 '17 at 19:40chmod
changes permissions,chown
changes owner. 755 first digit (7) means that 'owner' has all permissions, while second and last digits (5) mean that 'group' and 'other' both have read and execute permissions. You could add your user to the group and give full permissions to group too so that you don't have to make that many changes. – Samuel Apr 14 '17 at 19:45