Login using server accounts
Posted: Fri Jun 06, 2003 3:02 pm
Situation:
My server has several web accounts (/home/*/public_html). I am trying to write a pseudo-WS_FTP program to permit upload/management of files on the server, including mkdir, rmdir, chmod, etc.
Problem:
There is a security issue. I want users to be able to create/alter files in their directories only, similiar to if they were accessing the server via WS_FTP or an SSH client (user1 can play with files in /home/user1/, but not in /home/user2/). Therefore, doing a chmod(0777) to all directories is not an option.
What I basically need is a way for PHP to login to the server as if the user is coming from an SSH console.
Note: Since I am the sys admin, I can easily make a DB table with username/password/homeDir combinations when I set up new users.
Note 2: Having users go through WS_FTP, PSFTP, etc., is not an option according to my boss.
My server has several web accounts (/home/*/public_html). I am trying to write a pseudo-WS_FTP program to permit upload/management of files on the server, including mkdir, rmdir, chmod, etc.
Problem:
There is a security issue. I want users to be able to create/alter files in their directories only, similiar to if they were accessing the server via WS_FTP or an SSH client (user1 can play with files in /home/user1/, but not in /home/user2/). Therefore, doing a chmod(0777) to all directories is not an option.
What I basically need is a way for PHP to login to the server as if the user is coming from an SSH console.
Note: Since I am the sys admin, I can easily make a DB table with username/password/homeDir combinations when I set up new users.
Note 2: Having users go through WS_FTP, PSFTP, etc., is not an option according to my boss.