Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to find the most secure way to transfer files from one server to another.

I have the following architecture:

Architecture

Currently I am using the main user salamis in order to mount the directories.

The files in the original directory are created through a PHP file manager elfinder.

Unfortunately, I am not able to move, rename or delete any file from the mounted directory through PHP. I get permission denied.

1) Is it because I mounted the filesystem using salamis instead of www-data?

2) Is it secure to mount the filesystem on Server 2 as www-data ? If yes, how can I achieve that? www-data does not have a password and I cannot login using su -m www-data. I get authentication failure.

3) Can you think of a better architecture?

share|improve this question
add comment

1 Answer 1

Like you suspected, it's probably an issue of uid/gid mapping. First you'll want to find the uid of www-data:

$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

Then you can ask sshfs to map like:

$ sshfs -o uid=33,gid=33 <remote> <local>

That may solve it.

As far as design goes, just beware that if your ssh connection drops, so goes the mounted file system. I'm not aware of an easy way to detect it (other than maybe a cron job that detects it). NFS might be more robust if it's an option. I do find sshfs quite handy, though.

share|improve this answer
    
I used -o reconnect option to overcome that problem. Where should I put that? server 2 right? –  salamis Feb 8 '12 at 21:31
    
Yeah. Cool, didn't know about that option. You should be able to just add these two to your existing options (it's just a comma separated list) and then do the sshfs as your normal user. –  FatalError Feb 8 '12 at 22:04
add comment

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.