LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Server Services start after login and remain running (https://www.linuxquestions.org/questions/linux-security-4/server-services-start-after-login-and-remain-running-4175419841/)

Catalyph 08-01-2012 04:35 PM

Server Services start after login and remain running
 
I would like to have my server boot up and the only service to start be SSH.
On a particular user has logged in then other services will start and remain started until the next reboot.

My goal is to have data available via Network share only after the admin has logged into the system.
The main data storage device will be encrypted.

If the machine is removed or powered off from it's location the data will not be accessible until the certain user logs in.

Basically once this user logs in, the system will mount, decrypt and share via SMBD the drive, and those services will remain running even after the user has logged out.

r0b0 08-06-2012 07:26 AM

Hi Catalyph and welcome to LQ!

I would set all the services not to be started on boot
Code:

update-rc.d mysql disable
Then I would write a shell script to start all the services (in the correct order, asking for necessary passwords and such). Then I would either run the script manually on logon or add it to .profile file to be executed automatically.

R.

414N 08-06-2012 07:36 AM

But what distro are you running on the server machine?

Catalyph 08-06-2012 03:11 PM

Actually I figured it out.
I was using ubuntu server 11.10
What I did was go into /etc/init and opened the service in this case smbd.conf in vi
In the service conf script one of the first lines is

Quote:

Stop in runlevel [!2345]
I took out the ! (not) so it became:
Quote:

Stop in runlevel [2345]
Then I went the the .bashrc file in the user home folder and added encryption mount and start the smbd service

So now I have a Server that if it is unplugged (by a thief) and stolen, they will not be able to get my data unless they know the password for my account which is fairly robust.

When i log into the server the encrypted volume is mounted using a keyfile I created and added to the keyslot of the encrypted drive.
and then the smbd service is started to a directory where the mounted encrypted drive is.

it requires me to enter my user password 2 times ( once for log in and then for sudo mount) which is pretty good and i'm satisfied.


All times are GMT -5. The time now is 02:02 PM.