Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On LAMP for web apps in PHP we use common ownership: all files all owned by user webmaster and group www-data. User webmaster has full access, www-data (used by apache) mostly read-only. Multiple admins/developers connect to this server via SSH on this same user (webmaster).

What I would like is to allow multiple developers login to user webmaster via SSH to interactive shell, but have their own customized startup scripts.

Possible solutions:

  1. Modify .profile/.bashrc to recognize different remote users. But I don't know how, I can not use remore user IP (we work often from home).
  2. Use ssh the way it opens interactive shell on remote server and then calls specific command on remote server inside this shell. Even better if configurable in .ssh/.config so command line can still be simple ssh myserveralias. But I don't know how do do this either.
share|improve this question

2 Answers 2

  1. I think what you should to is:

    • to have all web files owned by real owner, uniq owner per specific user.
  2. I would put in ~webuser/.ssh/authorized_keys each users' public key 'command=/foo user1' string where user1 would be his real username. The command '/foo' would run some commands as described in a config wher you would defined that for user1 run that or that...

Anyway, isn't more better setup to use sudo and good ownership and have your users to login with user own login?

share|improve this answer
    
Re 1. to have all web files owned by real owner: If user Alice creates web project, most files/dirs will be for group www-data read-only (good security practice). User Bob than has troubles modify files. Re 2. 'command=/foo user1' inside ~webuser/.ssh/authorized_keys: it may be solution if /foo will be some super smart script, but makes it hard to use other SSH use scenarios like scp/sftp . Also command must be manually invoked by any user, so half-solution where each users after connection just invokes his own script manually is propably much simpler –  Stepan Feb 22 '12 at 8:40

Solution I found: use SSH option SendEnv on client plus AcceptEnv on server to pass to server for example local user name variable. Then modify .profile/.bashrc on server to use this variable to modify behaviour.

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.