Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a server which has dual authentication layer. Meaning first a user has to login to the box using his userid and then use a group id to access the development folder (say). Now I have a script which uses ssh to copy a file to the development folder. What should be the command for this?

Normal ssh commands such as as ssh $user@host $cmd where $cmd is something like cp ~user/Test.txt ~grp/ won't work because we are using user's id to copy to group's directory which is not allowed. And if we use group id to login it will be denied permission. Any suggestions?

share|improve this question
    
got the answer...I can use rsh and modify .rhosts file on remote machine to include source machine ip and username for passwordless connection. –  Abhishek Anand Mar 23 '11 at 6:55
1  
A sysadmin who cares about security shouldn't allow the "r" commands. They are completely insecure. There's an excellent chance that as soon as they discover you doing this, they will be upset with you. I recommend that you seek out an alternate solution. –  Warren Young Mar 23 '11 at 8:54
    
Your terminology is very confusing: apparently grp is a user (as far as the system is concerned), right? “Group” has a related but completely different meaning. How do users authenticate to grp? There's probably a better way to do what you're trying to do, but it depends on what you mean by “use a group id”, and on whether you can change that. –  Gilles Mar 23 '11 at 21:33
    
@Gilles What I meant was suppose I have a userid=anand and I belong to a team xyz which defines "abc" as login id for all its members to use on all the team owned servers. Now these servers are DAP enabled so the procedure is to first login using 'anand' and then su to 'abc'. Hope the terminology is more clear now. –  Abhishek Anand Mar 24 '11 at 4:16

2 Answers 2

Could the problem be that you use ~/user and ~/grp (both being directories relative to the home directory of the logged in user) instead of ~user and ~grp (meaning two different users' home directories)?

It's a bit hard to tell from your problem description what the problem really is. Normally, it sounds like "user" should be part of the same group that "grp" is, and the directory should be group writable.

Stay away from the r-commands. SSH can do everything better and more secure.

share|improve this answer
    
sorry for the typo..it is cp ~user/Test.txt ~grp/ stupid mistake....but by grp I mean a group id(teamid) used by several people. It has no relation to individual userid. –  Abhishek Anand Mar 23 '11 at 11:29

The best solution would be to use groups to manage groups — that's what they're for. Instead of giving the team the password to the grp account, make grp a group and make sure all files that should be accessible to the team are owned by that group and have group read and write permissions (as applicable). Using groups has many advantages, including instantly solving your immediate problem.

If you can't do that because it's a policy set by your boss and he's stubborn, can you at least arrange to use something other than password authentication to get to the su account? For example, if you can add your ssh public key to the team account's ~/.ssh/authorized_keys, you'll be able to ssh directly into it. (This is not a good way of managing authorizations, but you're abusing the system already by not using groups.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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