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