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

I'm developing a server application for ubuntu server, clients will connect to in through socket connection. It's in beta stage and under heavy development. At the moment lots of people are using it and it is updated almost every day. So I seed to seriously consider security issues and in the same time don't restrict myself too much. Now I have two questions:

  1. Where is the appropriate place to store its files? Application consists of executable, some config files and startup script. But I don't want to spread it accross the filesystem just store in single folder for convenience since app is under heavy development. My guess would be to create new dir under /var. Right now I store it in my home folder.

  2. Do I need to create separate user for it? I start it up using init.d script via sudo -u me. I want to restrict its access to system for security purposes but in the same time I want to be able to update it through FTP and not run into access issues (user that uploads it is different from user that runs it, and it sometimes need write access to some files). How to do that?

UPDATE: I forgot to mention that this application isn't redistributable. It is a web service that will exist in single instance at our server.

share|improve this question
    
I suspect there's more to it here than is outlined; if it's just an executable and a couple scripts/configs, can't you just program the application to take a config file setting for paths and store the application under whatever folder you want? And what security issues are you having trouble with if it's accessed through a socket connection, without direct access to the file? –  Bart Silverstrim Sep 6 '11 at 19:52
    
Are you using some form of version control for your source? –  Bart Silverstrim Sep 6 '11 at 19:53
    
Just to clarify a bit. Do you ever plan on distributing this application to other users? Or is it strictly internal, with no chance of ever being used outside your network? –  Zoredache Sep 6 '11 at 19:56
    
I'd probably set it up to work in a virtual machine so it's easier to back up and "sandbox", but that's me :-) –  Bart Silverstrim Sep 6 '11 at 20:00
1  
There may be some issues if you are unable to unmarry the application from the dev box. Was this by design? How maintainable will it be? And how will it be backed up or moved to a production system? –  Bart Silverstrim Sep 6 '11 at 20:10

3 Answers 3

up vote 2 down vote accepted

These are really mater of preference so I will answer as such.

I'd suggest using /opt/appname to keep your files. Some of the projects I've worked win in the past drop everything in there and then eventually separate it out to subfolders from there. You can symlink your init script back to this directory as well.

If you are using a dedicated user to run the application your installer should generally create the user ID to be used.. That is however a matter of preference on my part. I've seen a lot of projects go either way.

share|improve this answer
    
I forgot to mention that app isn't redistributable. –  Poma Sep 6 '11 at 20:03

Where is the appropriate place to store its files? Application consists of executable, some config files and startup script. But I don't want to spread it accross the filesystem just store in single folder for convenience since app is under heavy development. My guess would be to create new dir under /var. Right now I store it in my home folder.

I strongly believe that you should follow the FHS especially while it is heavy development, you should develop your application to follow the standards so it can be used in production. Configuration belongs in /etc, binaries usually under /usr/bin, per-user data in /home, shared data in /var or /srv. If you want everything to appear to be in a single folder, then use symlinks to make everything appear to be in a single location. Start developing it correctly at the start, and you won't run into any weird gotcha's in the future when you realize that you made some poor decision that would require you a lot of effort to make it right.

In the best world, your application could be easily reconfigured and no paths were baked in. Make it easy to move configuration, data, to anywhere that is appropriate.

Do I need to create separate user for it?

It completely depends on the application, but you should avoid having services running as root whenever possible. You should also avoid running it as your personal account.

share|improve this answer
    
I forgot to mention that app isn't redistributable. –  Poma Sep 6 '11 at 20:03

If it's your application you could store it under /opt since it's a third party application. You can find more information on directory structure at http://slashmedia.wordpress.com/2007/12/23/linux-directory-structure/

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.