Question

I would like to have two users to be able to edit my authorised_keys file. Is this possible?

I have tried to add the user to the original user etc/group this didn't work.

e.g. user1:xx:user2

Was it helpful?

Solution

/etc/group lists group ids, not user ids. If you're on a system where each user is given their own group (user1:user1), this is ok, otherwise create a new group and put both users in it.

In any case you'll also need to make sure that the authorized_keys file belongs to the group in question (use chown if necessary), that it is group-writable (chmod g+w authorized_keys), and that user2 has execute permission for all the directories on the path leading to authorized_keys.

PS. When you're done, it is possible that your ssh might decide the file is unsafe and refuse to read it. In that case your work will be in vain, but you can always set up a setuid program to edit the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top