{"id":1548,"date":"2011-08-21T22:07:52","date_gmt":"2011-08-21T21:07:52","guid":{"rendered":"http:\/\/www.haydnwilliams.com\/blog\/?p=1548"},"modified":"2022-04-11T21:34:00","modified_gmt":"2022-04-11T20:34:00","slug":"uhs2-admin-tools","status":"publish","type":"post","link":"https:\/\/www.haydnwilliams.com\/blog\/uhs2-admin-tools\/","title":{"rendered":"UHS2 &#8211; Admin tools"},"content":{"rendered":"<h2>Making sure services auto-start<\/h2>\n<p>You&#8217;ve taken the time to set up all the services you need on your server, so it&#8217;s probably best to make sure that if (<em>i.e.<\/em> when) you have to reboot, they all start again automatically. You can see the current status of services on your system by issuing:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">chkconfig<\/pre>\n<p>To turn something on or off by default, use the <strong>-s<\/strong> switch, the name of the service, and the default sate:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo chkconfig -s apache2 on<\/pre>\n<h2>Wake-on-LAN<\/h2>\n<p>Our server doesn&#8217;t need to be turned on 24-hours a day, but equally I don&#8217;t want to have to go into the cupboard under the stairs to turn it on each time I do want to use it. Wake-on-LAN is a feature which lets you wake a machine up from a suspend state, just by sending a &#8216;MagicPacket&#8217; to it over the network. To enable it, you&#8217;ll first have to make sure that your motherboard supports it, and that it&#8217;s turned on in your BIOS settings. To enable support in Ubuntu, you&#8217;ll need a package called <strong>ethtool<\/strong>. If it&#8217;s not already installed, you can get it using <strong>apt-get<\/strong>. Running it without any switches will give you information about the network connection you pass to it:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">ethtool eth0<\/pre>\n<p>Note that there is a section relating to Wake events:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Supports Wake-on: pumbg\r\nWake-on: g<\/pre>\n<p>You can get a definition of each of the letters by running <strong>man ethtool<\/strong>, but the crucial thing here is that &#8216;<strong>g<\/strong>&#8216; represents the LAN-based MagicPacket method we&#8217;ll be using. In my case it&#8217;s already enabled, but if yours says &#8216;<strong>d<\/strong>&#8216;, which means support is turned off, then you can activate it with the <strong>-s<\/strong> switch:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">ethtool -s eth0 wol g<\/pre>\n<p>There are a couple of ways of making sure WOL support is maintained across reboots; check them out in the <a title=\"Using Wake-on-LAN with Ubuntu\" href=\"https:\/\/help.ubuntu.com\/community\/WakeOnLan\" target=\"_blank\" rel=\"noopener\">Ubuntu Community Documentation<\/a> and on <a title=\"Tim Child\" href=\"http:\/\/blog.timc3.com\/2010\/08\/06\/wake-on-lan-with-ubuntu\/\" target=\"_blank\" rel=\"noopener\">Tim Child&#8217;s blog<\/a>.<\/p>\n<p>Obviously once you&#8217;ve enabled support for WOL on your server, you&#8217;ll need some way to send the MagicPackets that wake it up. The programs I use are WakeOnLan on my Mac [edit: apparently <a href=\"http:\/\/www.macupdate.com\/app\/mac\/15779\/wakeonlan\" title=\"WakeOnLan\" target=\"_blank\" rel=\"noopener\">now defunct<\/a>] and <a title=\"iNet WOL on iTunes Store\" href=\"http:\/\/itunes.apple.com\/us\/app\/inet-wol-wake-on-lan\/id318696675?mt=8\" target=\"_blank\" rel=\"noopener\">iNet WOL<\/a> on the iPhone.<\/p>\n<h2>Remote Access<\/h2>\n<p>For the reasons of ease-of-access outlined above, combined with the fact that you may not have a monitor and\/or keyboard attached to your server, the ability to access it from other machines can be very useful. There are basically two ways to do this.<\/p>\n<h4>1) SSH<\/h4>\n<p>An <a href=\"http:\/\/www.haydnwilliams.com\/blog\/uhs6-ssh-subversion-svn\" title=\"UHS6 - SSH &#038; Subversion (SVN)\" target=\"_blank\" rel=\"noopener\">earlier post dealt with installing SSH<\/a>, and you may use it in conjunction with Subversion, for example. However, it&#8217;s also very useful for giving you a command-line login to a remote machine. Simply start SSH with your login details:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">ssh user@192.168.0.1<\/pre>\n<p>Enter your password and you&#8217;ll have a Terminal prompt on the remote box. The advantage of this is that you can do it even if there&#8217;s no-one logged onto the server; this puts it at a definite advantage to the next method.<\/p>\n<h4>2) Remote Desktop<\/h4>\n<p>SSH is great for a lot of things, but in it&#8217;s vanilla form it doesn&#8217;t let you run anything with an <a title=\"X Window System on wikipedia.org\" href=\"http:\/\/en.wikipedia.org\/wiki\/X_window_system\" target=\"_blank\" rel=\"noopener\">X window<\/a> GUI. As it&#8217;s name would suggest, remote Desktop lets you use a <a title=\"Virtual Network Computing (VNC) on wikipedia.org\" href=\"http:\/\/en.wikipedia.org\/wiki\/VNC\" target=\"_blank\" rel=\"noopener\">VNC<\/a> connection to show the desktop of a remote machine on a client, exactly as though you were sat in front of the remote monitor. It&#8217;s easy to set up in Ubuntu &#8211; just open the &#8220;<em>Remote Desktop<\/em>&#8221; application and decide on the appropriate settings.<\/p>\n<div id=\"attachment_1565\" style=\"width: 460px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1565\" class=\"size-full wp-image-1565\" title=\"Remote Desktop settings in Ubuntu 11.04\" src=\"http:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2011\/06\/20110622c.jpg\" alt=\"Remote Desktop settings in Ubuntu 11.04\" width=\"450\" height=\"420\" srcset=\"https:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2011\/06\/20110622c.jpg 450w, https:\/\/www.haydnwilliams.com\/blog\/wp-content\/uploads\/2011\/06\/20110622c-300x280.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><p id=\"caption-attachment-1565\" class=\"wp-caption-text\">Remote Desktop settings in Ubuntu 11.04<\/p><\/div>\n<p>The system helpfully informs you whether your machine can be connected to just from the local network (more secure) or from the internet at large (less secure). Remote Desktop can be very useful, but there is a caveat to bear in mind: someone must be logged on to the remote machine for it to work.<\/p>\n<p>The alternative is to use a program called vnc4server. This can be installed using apt-get, but again there is a caveat. With the introduction of Unity instead of GNOME in v11.04 of Ubuntu, VNC access seems to have got a little confused. The steps below will let you connect to a server without needing to be logged on already, but you&#8217;ll only be able to access the GNOME version of Ubuntu (AKA &#8220;Classic&#8221;), and there&#8217;s rumours that may not be available in future releases. If you do want to do it, steps I gleaned from <a title=\"Steven Cami\u00f1a - Setting up remote desktop without monitor\" href=\"http:\/\/stevencamina.blogspot.com\/2009\/09\/setting-up-remote-desktop-without.html\" target=\"_blank\" rel=\"noopener\">here<\/a> and <a title=\"Imthiaz blog - Ubuntu 9.04 remote desktop using vncserver without monitor\" href=\"http:\/\/imthi.com\/blog\/linux\/ubuntu-904-remote-desktop-using-vncserver-without-monitor.php\" target=\"_blank\" rel=\"noopener\">here<\/a> are summarised below:<\/p>\n<ol>\n<li>Install vncserver with:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo apt-get install vnc4server<\/pre>\n<\/li>\n<li>Ensure you&#8217;re logged in as a &#8220;Desktop&#8221; user for the next steps; if you start your VNC server logged in as an Administrator account then anyone connecting using VNC will have root access.<\/li>\n<li>Start the VNC server to create a settings file:\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">vncserver :1<\/pre>\n<\/li>\n<li>Choose a password when prompted. This will be required when connections are made to the server. It can be changed with the command <strong>vncpasswd<\/strong>.<\/li>\n<li>Kill the server so we can change the settings: <code>vncserver -kill :1<\/code><\/li>\n<li>Edit the settings file<strong> ~\/.vnc\/xstartup<\/strong><\/li>\n<li>Remove the comment markers from the first two lines, replace &#8216;<strong>exec<\/strong>&#8216; with &#8216;<strong>.<\/strong>&#8216;, and finally comment out the final line. Your amended file should look like this:\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">#!\/bin\/sh# Uncomment the following two lines for normal desktop:\r\nunset SESSION_MANAGER\r\n. \/etc\/X11\/xinit\/xinitrc\r\n&#x5B; -x \/etc\/vnc\/xstartup ] &amp;&amp; exec \/etc\/vnc\/xstartup\r\n&#x5B; -r $HOME\/.Xresources ] &amp;&amp; xrdb $HOME\/.Xresources\r\nxsetroot -solid grey\r\nvncconfig -iconic &amp;amp;\r\nx-terminal-emulator -geometry 80x24+10+10 -ls -title &quot;$VNCDESKTOP Desktop&quot; &amp;amp;\r\n#x-window-manager &amp;amp;\r\n<\/pre>\n<\/li>\n<li>Restart the server:<code>vncserver :1<\/code><\/li>\n<li>Log out of the machine<\/li>\n<li>Connect from your remote machine (I use <a title=\"Chicken of the VNC on sourceforge.net\" href=\"http:\/\/sourceforge.net\/projects\/cotvnc\/\" target=\"_blank\" rel=\"noopener\">Chicken of the VNC<\/a> on my Mac &#8211; weird name but a nice program).<\/li>\n<\/ol>\n<p>If everything&#8217;s gone well you&#8217;ll have a GNOME session, <em>i.e.<\/em> Ubuntu &#8220;Classic&#8221;, logged in as whichever user you chose in step 2) above. If things have gone very well, you may even have Unity, <a href=\"http:\/\/www.techotopia.com\/index.php\/Remote_Access_to_the_Ubuntu_11.04_Unity_Desktop#Attaching_to_a_Remote_Unity_Desktop_using_vncviewer\">according to this article<\/a>, although I still only get GNOME. It seems I&#8217;m <a href=\"http:\/\/ubuntuforums.org\/archive\/index.php\/t-1763285.html\">not the only one<\/a> who has struggled with this, either.<\/p>\n<h4>3) Extra Bits and Bobs<\/h4>\n<p>Finally, a couple of things you might want to consider if you like tweaking things, gleaned from <a title=\"BillMal Your Lotus Pal\" href=\"http:\/\/www.billmal.com\/billmal\/billmal.nsf\/dx\/05182011125420AMWMA7RZ.htm\" target=\"_blank\" rel=\"noopener\">BillMal<\/a>. <em>Startup Manager<\/em> gives you a bit more control over Grub, while <em>Ubuntu Tweak<\/em> does exactly what its name would suggest. You&#8217;ll need to add a software repository to get Ubuntu Tweak, so the code to install using apt-get is as follows:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">sudo add-apt-repository ppa:tualatrix\/ppa\r\nsudo apt-get update\r\nsudo apt-get install ubuntu-tweak<\/pre>\n<p><em><a href=\"https:\/\/help.ubuntu.com\/community\/StartUpManager\" title=\"Startup Manager - Ubuntu community documentation\" target=\"_blank\" rel=\"noopener\">Startup Manager<\/a><\/em> and <em><a href=\"http:\/\/ubuntu-tweak.com\/\" title=\"Ubuntu Tweak\" target=\"_blank\" rel=\"noopener\">Ubuntu Tweak<\/a><\/em> are both GUI applications, as is another useful pre-installed one which provides more customisation options, named <em>CompizConfig Settings Manager<\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Making sure services auto-start You&#8217;ve taken the time to set&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[663,666,667,665,510,664,684,517,683,522,523],"class_list":["post-1548","post","type-post","status-publish","format-standard","hentry","category-it","tag-chkconfig","tag-magic-packet","tag-remote-desktop","tag-run-at-startup","tag-ssh","tag-ubuntu-services","tag-unity","tag-vnc","tag-vncserver","tag-wake-on-lan","tag-wol"],"_links":{"self":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts\/1548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/comments?post=1548"}],"version-history":[{"count":0,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/posts\/1548\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/media?parent=1548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/categories?post=1548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.haydnwilliams.com\/blog\/wp-json\/wp\/v2\/tags?post=1548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}