Module 4 milestone 3 how to change permission

I am trying to change the file permissions through local_umask parameter in the .conf file.
According to my requirements, I have assigned it a value 644. But, the files after uploading are getting other permissions, in my case, -r–rw–w-, which I should have got for 462 value.
p.s. The permissions now are different from those when the local_umask command was not added.

You should carefully read the manual for vsftpd parameters and check the usage of local_umask parameter. You need to change its value such that permission matches to that of benchmark file.

@Monika11sharma
This was one of my key takeaways from module 4

The umask is used to remove from the default assigned permissions certain permissions in different scenarios. So, contrary to normal file access permissions we set for files using chmod this works in reverse.

Normally, file permissions default to 664. Now, let’s say a new user logged in and he is not the owner of the file. If we don’t want him to make changes to the file, we set a umask of 020 to not give him write access. Here, the resultant file permission will be
original - umask = 664 - 020 = 644

See more here: https://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

Let me know if it helped :slight_smile:

1 Like

Yeah it was resolved. Basically all I had to do was open a file in a particular mode and then umask the unwanted permissions. Thanks! I was repeatedly stuck on such a silly mistake.

Great. Yeah, things were puzzling around in my head as I tried different umask values and they weren’t making any sense.
Please close the thread.

please someone tell me do i have to just the file permissions after transfering using ftp?
why it is needed to add something in vsftpd.conf if i can manually see and check and what will it do if i add that file_open_mode ?

first of all, you have to check which of the versions is faulty. After that, you need to make some changes in the vsftpd.conf file so that the file permissions can be set to the desired ones (those that you set in the benchmark) no matter what permissions they have before being uploaded.

the file_open_mode along with some other parameters as well is basically to set these permissions. Google it, you will get to know more about it.