0

We connect to the Linux server from windows using putty and we all share the common user and password. I'm creating a file and I want to give read only permission to others but if I login (from my machine) then I should have full access to the file.

Since we all share the same user/pwd I cannot the bifurcate the permissions based on the user.

Is it possible to give the permissions to a file based on from which machine(IP address) logged in?

  • 1
    If you all share a single user account, there are no "others". Unix file permissions are tied to the user and the user's group memberships. Could you give an example of what the permissions on the file should look like? What user account should own the file? – Kusalananda Sep 20 '19 at 5:42
  • @Kusalananda I'm aware that file permissions are tied to the user but here I want to have full permissions (755) only if logged in from my windows machine (based on IP probably) – Aravind Sep 20 '19 at 5:49
  • Then create a separate user that you log in to from your Windows machine and make sure that the files belong to that user. – Kusalananda Sep 20 '19 at 6:51
3

Is it possible to give the permissions to a file based on from which machine (IP address) [the user is] logged in?

No, it's not possible. The traditional Linux access framework uses DAC (Discretionary Access Control), based on users and groups. Even ACLs, which allow for more fine-grained permissions, are based on that. And so (IIRC) are PAMs.

Theoretically, you might perhaps find a SElinux policy that does something similar to what you want, but it is a very ill-advised solution.

It looks like the server you use is badly administered. If all of you have the same account, there are no separate people, there is only one "user". You should instead have the sysadmin create separate Linux accounts for you and your colleagues, and go from there.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.