Category Archives: sysadmin

Accessing Server from Android

Recently I help maintain some server, sometime I tend to move around. So I decide to make my phone to be useful.

Android actually have a couple of app that is useful to remotely access a machine. Some of them is free.
For connecting to SSH, I found that connectbot works extremely well. It only does ssh and telnet, and thats about it. It is pretty straight forward to use. For accessing windows server, I use 2x client. Which again another another straight forward RDP client. Both connectbox and 2x client is free, and that is awesome.

The only issue on using android phone to access a server remotely is. I have a desire hd. While the screen is pretty large for a phone, typing command via ssh or, navigate around a windows server via RDP can be still a pain. It is still smaller that most desktop screen. And I don’t have a full size keyboard on the phone. Which is another pain especially I access linux server most of the time.

So it can be a pain to use at time. But for quick fix or checking on server. This work pretty well.

I attached some links for the app below

the userdir apache module

By default, the apache webroot, in ubuntu, or most distro. Is in /var/www. Which is not really a big deal, except, it’s a pain to finish writing a php script, then as root, or sudo to cp to /var/www.
If it’s just a server, it’s perfectly fine, for a development machine, it’s a pain.

On the other hand. There is a userdir, module in apache. What it does basically, is it enable you to put your file in your home directory, then apache will serve the file there. By default, apache will search in /home/youraccount/public_html, or /home/useraccount/www or /usr/www. To access the file, you just need to call by http://yourserveraddress/~youraccount, with a browser.

To make it easy for me to write stuff into, i just use the form in my home directory. The implication is that, you can redirect your ide to use the directory as your work space.

To do it on ubuntu, inside, /etc/apache2 have a mods-available directory, another is mods-enabled directory. The former is the modules available, the latter is just a symbolic links, to the modules in mods-available.

To enable userdir, in /etc/apache2
run the following in a shell

sudo ln -s mods-available/userdir.load mods-enabled/
sudo ln -s mods-available/userdir.conf mods-enabled/

and don’t forget to create, public_html in your home directory.
to test it just call your browser direct to http://localhost/~yourusername

Or do it properly, we can start a small web hosting business
, or have friends to share a web space, on your server. etc.

being a dictator syadmin: finding bandwidth usage for each host

Yesterdays post, revolve around blocking sites. One of the reason, someone up above, insist that filesharing sites are a source of virus, worms and their friends. So they throttle the network, until I fix it, by blocking it.

Another reason, is we are using a thin pipe, and we are using quite a lot of bandwidth. Which I think we are student, there is not much we can do. Either way, I have not much of a choice, but to track it.

Webmin have a utilities to gather bandwidth usage statistics, which have one problem, take s a lot of cpu cycle, and slow down a server and I have to kill it. Until I figure out how to reconfigure it.

MRTG can do that too. except, to check out each host, you need to have snmp agents install on them. Which I can’t because it is a dorm, and the computer is private property. So here, mrtg is monitor the server only. Life is so simple, when this is a work space.

On the other hand, linux have a few utilities for this as well. The one I use, is iftop. Best describe as top for network. It is in repository for most distro. It can be used to check bandwidth usage of each host.

To call it, just type

iftop -i ethx

you should get all the data from that interface. In a ncurse interface.

But the data don’t stay, when you restart the program it will start again. Nevertheless, still useful. For someone who can’t use snmp for the task.

server project: cache is full

Today we got the problem where our squid server shutdown because of disk full error:

the solution for that, after check around the faq is:
(our cache is in /var/spool/squid, since it is from the repo), change it to your cache directory
cd /var/spool/squid

type this, in /var/spool/squid:

echo “”>swap.state

make sure you have root access before you attempt it.

been playing with linux system accounting

One day I play around on my laptop, which I found the acct utilities, which I wonder when I install. Anyway, later I found out what it is. Actually it is a unix system accounting. Which contain a few utilities, such as:
– sa
– ac
– lastcomm

So play around I did. So I start with sa. Which I get a set of statistics of io, memory and cpu usage.

7924 800.15re 18.51cp 0avio 2835k
55 262.28re 17.77cp 0avio 2848k ***other*
46 53.41re 0.30cp 0avio 8430k gdl_indexer
47 1.55re 0.16cp 0avio 2079k apport
21 0.32re 0.13cp 0avio 6228k mono
46 0.68re 0.08cp 0avio 8430k gdl_indexer*
29 0.12re 0.02cp 0avio 478k gzip
2619 1.12re 0.01cp 0avio 514k file
2 0.04re 0.01cp 0avio 936k vrms
4 0.57re 0.00cp 0avio 2317k apache2
10 0.30re 0.00cp 0avio 704k dhclient-script
11 50.67re 0.00cp 0avio 0k pdflush*
12 0.11re 0.00cp 0avio 573k gpgv
2 0.01re 0.00cp 0avio 4346k kde-config
2 0.01re 0.00cp 0avio 1210k troff
—-output truncated——–

which not really sorted. So later i found out a parameter for sa, –sort-cpu-avmem

8484 804.23re 18.61cp 0avio 2808k
7 0.20re 0.00cp 0avio 28526k pidgin*
922 0.01re 0.00cp 0avio 19963k beagled-helper*
26 0.12re 0.04cp 0avio 19648k totem-video-ind
49 57.01re 0.33cp 0avio 8457k gdl_indexer
49 0.69re 0.08cp 0avio 8457k gdl_indexer*
6 374.57re 0.00cp 0avio 6753k apache2*
21 0.32re 0.13cp 0avio 6228k mono
2 0.01re 0.00cp 0avio 4346k kde-config
56 262.28re 17.78cp 0avio 2793k ***other*
10 0.10re 0.00cp 0avio 2374k smbd*
4 0.57re 0.00cp 0avio 2317k apache2
—-output truncated——–

which interesting because, pidgin take 28meg of memory, or i read wrong. most of the time I get firefox using 50meg.

another interesting command is lastcomm. which display the last command executed.

—–above line deleted————
find root ?? 0.00 secs Sun Aug 12 09:07
xargs root ?? 0.00 secs Sun Aug 12 09:07
rm root ?? 0.00 secs Sun Aug 12 09:07
find root ?? 0.00 secs Sun Aug 12 09:07
acct root ?? 0.00 secs Sun Aug 12 09:07
acct root ?? 0.00 secs Sun Aug 12 09:07
acct root ?? 0.00 secs Sun Aug 12 09:07
accton S root ?? 0.00 secs Sun Aug 12 09:07

which I didn’t fully explore yet. lastly is the ca utility. which can display the amount of time a user log in to the system, for a week.

which all of this is new to actually.

Discovered unix system accounting tools

So I was browsing around my laptop, which by incident found, acct. Which is a set of unix system accounting tools. Which from documents stored on my laptop, have:
– accton: which use to turn on/off system accounting
– ac: to show user connect time
– sa: summarize system accounting info.
– lastcomm: which printout previously executed command.
ac, is to print out user connect info. Which if executed directly just print out:

[email protected]:~$ ac
total 82.92

which really nothing, but it have a few parameter