2

I am using "UbuntuServer13.10" on my server and "Windows7-SP1" On my PC. Now I want to edit, add, delete, rename my files and folders in server using FTP. For this purpose, I installed "FileZilla 3.7.4.1 win32" in my PC and then try to connect my server though using it. I added my internal server IP(sftp://192.168.1.99) and my username(Ubuntu username not root) and password and added Port22. After this I was able to see my server files on FileZilla but not able to edit, add, delete, rename my files and folders in server using FileZilla.

When I try to add files then get "open for write: permission denied" and when try to delete file get "permission denied". Now my main question is that "How To Edit/Add/Delete/Rename Files/Folders In Ubuntu Server Using FileZilla?". Waiting for your reply...

2 Answers 2

1

Have you tried executing the command ls -l on the folder tou want to read/write on? The user you connect with might not have enough rights. This is usually the case when another user has created the files you want to access.

While ls -l lets you check who is the owner of the file/directory you want to access, to change permissions you can use chmod (more info here)

EDIT: If you want to manage the access right to a specific folder for a single user, you will have to either:

  • Create the folder so that the user is the owner, and thus has all rights on it
  • Make sure the owner of the folder allowed the user to access it

To do that, you could for instance change the ownership of the folder and atribute it to the user. That way, you could manage access rights the way you want. Juste type in sudo chown -R user /var/www/site1. This recursivelly (thanks to -R) attributes ownership to user.

For a bonus, you could chmod 500 /var/www/site1 so that no-one except user (and root, obviously) could read/write on the folder

NB: The 5 used as an argument for chmod means you grant read & write permission. To grant read, write & execute permission, use 7. To grant none use 0. The first number represent the permission for the owner, the second number represent the permission for the group, and the third represent the permission for the other users. Refer to the link provided if you need more info

NB2: To check your ownership/permission on a file or a folder, type ls -l /my/folder, and you should get something like this :

 -rw-r--r-- 1 root root 65 Feb 11 15:08 index.html
     |         |     |
  permissions  |     |
             owner   group
15
  • I just started it and I did nothing. Now I want to control my all files and folders in "var/WWW/..." Using FileZilla. Can you tell me completely that what to do to get control over the main folder. I think that "root" is the owner of file because I tried to edit edit, add, delete, rename my files and folders directly in my server through user but I was unable then I login via root then will able to do all action. Mar 25, 2014 at 15:14
  • ok then if you want your /var/www/ folder to be read and written to by all users, type as root (or use sudo) : chmod 555 /var/WWW/. If you want to read existing files, use chmod 555 /var/WWW/*. Please note that it is quite unsafe as it allows r/w permission for any user connecting to your server. If your server contains data you need to protect, you might want to play a bit with permissions
    – Aserre
    Mar 25, 2014 at 15:20
  • Thanks for replying me and also mentioning the after effects. So what you think is the best for me? I also want to keep me server secure. I currently have only one user like "user1". Is this possible to make a folder like "/var/www/site1" and allow only "user1" to edit, add, delete, rename my files and folders in it? Mar 25, 2014 at 15:29
  • I will update my answer to address your comment
    – Aserre
    Mar 25, 2014 at 15:39
  • Thanks to update your answer. I did as you said and I used user@server:~$ sudo mkdir /var/www/site1 and got my folder. Now in next step I wrote user@server:~$ chmod 700 /var/www/site1 and got chmod: changing permissions of ‘/var/www/site1’: Operation not permitted. What to do know? Mar 25, 2014 at 16:29
0

What you are doing is connecting with FTP over SSH (that's what SFTP is). So you are only able to do the operations that your user is permitted to do over SSH - if your user doesn't own or doesn't belong to a group that has write permissions on the files you are trying to edit or the folders you are trying to create files in, you won't be able to do this over SFTP (since you're not allowed to over SSH).

You can use ls -alh for example, to check what group those files and folders belong to and, if the group has write permissions over those files and folders, than add your user to that group and you should be good to go (over SFTP also).

1
  • I think that "root" is the owner of file because I tried to edit edit, add, delete, rename my files and folders directly in my server through user but I was unable then I login via root then will able to do all action. Can I connect "FileZilla" via "root" instead of my "username" so I think that after this I will be able to edit, add, delete, rename my files and folders. Am I right then how to connect via "root" Mar 25, 2014 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .