2

I have CentOS with one ssh user which is root.

How do I make one more user for my web developer so he can scp files over to /var/www/html ? Its gonna be a static page, so mysql and alike are out of question. All I need is that user to be able to scp in and out files of /var/www/html

I tried to add user with home dir as /var/www/html by typing

# adduser -d /var/www/html webdev

but
1. this user was not able to write files into this dir
2. he is able to browse other directories on the server

mattdm
  • 6,550
  • 1
  • 25
  • 48
sdc
  • 21
  • 2

2 Answers2

1

Why not setup a jail? This will restrict a user to a specific directory when they log in. There are a variety of guides on how to do this, so take your pick.

Additionally, you can either add the user to a group that owns the files, or you can chown the files so that anybody can write to them.

Andrew M.
  • 10,982
  • 2
  • 34
  • 29
1

Your issue is that of permissions. There are many ways to solve the issue. However, since this is for development purposes, the easiest thing to do would be to:

  1. Allow the user to upload files to his/her own home directory (typically ~/public_html).
  2. Allow the web-server access to these files through user directory access.

If you want something with more isolation, I might even recommend something like OpenVZ (over-glorified chroot) to be used to provide the developer with their individual development environments instead.

PS: Remember to restrict the user access by using rssh as the user shell. This limits it to scp/sftp access only.

sybreon
  • 7,357
  • 1
  • 19
  • 19