SSH, which is an acronym for Secure SHell, was designed and created to provide the best security when accessing another computer remotely. Not only does it encrypt the session, it also provides better authentication facilities, as well as features like secure file transfer, X session forwarding, port forwarding and more so that you can increase the security of other protocols. Galbraith and P. Remaker, The Secure Shell (SSH) Session Channel Break Extension, RFC 4335, January 2006. Kohno, and C. Namprempre, The Secure Shell (SSH) Transport Layer Encryption Modes, RFC 4344, January 2006. Harris, Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol, RFC 4345, January 2006. SSH Keys for CS (Mac and Linux). Using the manual method. If for any reason the ssh-copy-id method does not work, you can still copy your public SSH key manually.
How do I restart, say for example my httpd or afpd, running any Mac OS X >= 10.5 (Leopard-), without having to use the GUI and go to System Preferences -> Sharing and unchecking/checking 'Web Sharing'?
I'm looking for the canonical equivalent to Debian's invoke-rc.d apache2 restart
.
EDIT: The question is about launchd controlled services in general, not specifically Apache (-which was simply an example).
8 Answers
Hi launchctl(8) is your friend. Just keep in mind that some of the services (sshd for example) are disabled in the configuration file so you will need to use the -w
switch when loading them. Here is a sshd example:
You can stop the service using the unload
subcommand.
To list the services, as you might have already guessed use the 'list' subcommand ;)
have fun, n
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
You could simply do
If you don't known the full service name, you can do
If you still don't find the service you expected, try to run without the root identity:
And you don't need to unload and load service.
To restart a service, you can use the launchctl kickstart
command, together with the -k
option. For example, to restart apache, you can use
This information is from the launchctl
manual page:
Just in case if you are looking for launchctl reload
, you can define shell function in your ~/.bashrc/.zshrc
as I did:
Command execution looks like ->lctl reload <your-plist-name>.plist
Works with other OSses as well as it is part of Apache.
Sven♦SvenThere is a small & useful app for this named Lingon.Lingon freeware edition is here sometimes restarting a service can be tricky.
Mac Ssh Tool
reading helps though.