Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: How to check what services are running?

  1. #1
    Join Date
    Oct 2012
    Beans
    55

    How to check what services are running?

    I've been working my way down the basic security wiki https://wiki.ubuntu.com/BasicSecurity , and I came to this:

    'Don't run services you don't need. Do you really need a VOIP phone system? What about Secure Shell (SSH), Virtual Network Computing (VNC), Apache server? If you need a service, make sure you understand it and can properly secure it. You can't secure what you don't understand. '

    Seems like good advice (if you don't take it too literally - if I did I'd never turn the machine on).

    But how do I find out what services are running?

    Thanks

  2. #2
    Join Date
    Nov 2007
    Location
    Les Gets, France
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to check what services are running?

    Hi

    Open a terminal CTR+ALT+T and type

    top
    This shows a live listing of services. Type Q to exit back to prompt. You can kill a service by typing

    kill PID
    where PID is given by the top command. Have a read by typing

    man kill
    and
    man top
    Roger
    Acer Aspire 1353 Bodhilinux 2.3.0
    Toshiba A200 12.04(32 bit)
    Asus EeePC 1011PX 12.04 (32 bit) dual boot W7

  3. #3
    Join Date
    Nov 2008
    Beans
    Hidden!

    Re: How to check what services are running?

    If you rather have a GUI to work with use Gnome System Monitor

  4. #4
    Join Date
    Sep 2006
    Beans
    7,192
    Distro
    Lubuntu Development Release

    Re: How to check what services are running?

    Most services have been migrated over to using Upstart scripts from the old System V init scripts. You can find a list of services in the directory /etc/init/ where the service's configuration file will be there ending with .conf All the services using upstart will be there. The few remaining System V services will be in /etc/rc2.d/

    You can see the status of any specific service by using the name of the like this:

    Code:
    service ufw status
    service lightdm status
    service atd status
    # etc
    top will only show those services that are consuming a lot of RAM or CPU.

    A far as trimming it down, you can take away services you added yourself. But there is not too much you can take away from the default install before things start to break.

  5. #5
    Join Date
    Oct 2008
    Beans
    3,509

    Re: How to check what services are running?

    I can't advise which services you can disable but on my machine I disabled bluetooth
    and cups as I dont have a printer.

    Get a list of services...
    Code:
    initctl list | sort
    To check the status of a service you can just use
    status <service>
    eg
    Code:
    status bluetooth
    Then I created an override file for the service with "manual" in the config
    eg for bluetooth...
    Code:
    sudo sh -c "echo 'manual' > /etc/init/bluetooth.override"
    and
    for cups...
    Code:
    sudo sh -c "echo 'manual' > /etc/init/cups.override"
    To restore a service just remove the corresponding .override file you created in /etc/init/
    Last edited by stinkeye; October 27th, 2012 at 03:47 PM.

  6. #6
    Join Date
    Oct 2012
    Beans
    55

    Re: How to check what services are running?

    Thanks to all.

    I see a lot of things running that I can't yet really claim to know the purpose of, but the only things I put there are ddclient and freshclam, which I want.

    I think I'll leave well alone and move on to the next section of the wiki guide - this bit isn't perhaps so basic after all!

  7. #7
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How to check what services are running?

    Quote Originally Posted by stinkeye View Post
    To check the status of a service you can just use
    status <service>
    eg
    Code:
    status bluetooth
    Then I created an override file for the service with "manual" in the config
    eg for bluetooth...
    Code:
    sudo sh -c "echo 'manual' > /etc/init/bluetooth.override"
    and
    for cups...
    Code:
    sudo sh -c "echo 'manual' > /etc/init/cups.override"
    To restore a service just remove the corresponding .override file you created in /etc/init/
    I believe you can also run
    Code:
    sudo mv /etc/init/bluetooth.conf /etc/init/bluetooth.conf.disabled
    and reboot to disable a service. Reversing the process would be
    Code:
    sudo mv /etc/init/bluetooth.conf.disabled /etc/init/bluetooth.conf
    and reboot again.

  8. #8
    Join Date
    Oct 2012
    Beans
    55

    Re: How to check what services are running?

    Quote Originally Posted by oldos2er View Post
    I believe you can also run
    Code:
    sudo mv /etc/init/bluetooth.conf /etc/init/bluetooth.conf.disabled
    and reboot to disable a service. Reversing the process would be
    Code:
    sudo mv /etc/init/bluetooth.conf.disabled /etc/init/bluetooth.conf
    and reboot again.
    Thanks for the info. Just out of interest, is there any reason why these options would be preferred to just commenting the start line in the bluetooth.conf file, ie:

    # start on started dbus

    which was my first thought?
    Last edited by maglinu; October 27th, 2012 at 06:47 PM.

  9. #9
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How to check what services are running?

    Well, a simple ls /etc/init will tell you which services are disabled, rather than having to check the contents of each *.conf file.

  10. #10
    Join Date
    May 2007
    Beans
    314
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to check what services are running?

    You can also try htop which will be more informative than top.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •