iftop does for network usage what top does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts.
More info here.
Author Archives: cviorel - Page 11
iftop: display bandwidth usage on an interface
Install Firefox Add-ons for all Users
It is possible to install Firefox add-ons for all users that use a computer instead of installing them for every user separately. This is helpful if you are the computer guy in the family for instance and want everyone to have a basic set of extensions enabled that add functionality and security to the accounts.
The process of installing Firefox add-ons globally looks like the following. Download the xpi file instead of clicking on it which would install it directly. Once the add-on has been downloaded you use the following command at the run prompt (type Windows R):
firefox -install-global-extension
Let me give you an example:
firefox -install-global-extension c:\extension.xpi
The add-on will be silently installed and is available normally afterwards in the Tools > Add-ons menu of Firefox. Only administrators may uninstall the add-on but it is working for all users who are running Firefox.
Install Nodoka (Fedora theme) on Ubuntu
1. Install build-essential and libgtk2.0-dev packages:
1 |
sudo apt-get install build-essential libgtk2.0-dev |
2. Download Nodoka GTK+ engine 0.6 from here.
3. Extract tarball package:
1 |
tar zxvf gtk-nodoka-engine-0.6.90.2.tar.gz |
4. Now go to gtk-nodoka-engine-0.6 directory:
1 |
cd gtk-nodoka-engine-0.6.90.2 |
5. Configure:
1 |
./configure --prefix=/usr --enable-animation |
6. Make:
1 |
make |
7. Install:
1 |
sudo make install |
Install theme
1. Get Nodoka theme 0.3.2 from here.
Then execute command in terminal:
1 |
tar zxvf nodoka-theme-gnome-0.3.90.tar.gz |
2. Copy the Nodoka folder to themes folder:
1 |
cd nodoka-theme-gnome-0.3.90 |
1 |
sudo cp -r Nodoka/ /usr/share/themes/ |
Use theme
Click System -> Preferences -> Theme menu command. In Theme Preferences dialog, choose Nodoka item.
Qps Visual Process Manager
phpIP Management
phpIP Management is a complete IPv4 IPAM (IP address management) suite, built to handle the complexity of managing today’s IP address space. phpIP Management was built to scale and address the full lifecycle of IP address space using techniques that are not administratively intensive.
http://www.phpip.net/index.php
Play videos within *.rar files without unpacking/extracting them in Ubuntu
If you have downloaded some video and it’s packed in multi-volume archive, you can play the file without unpacking.
This is how you do it in Ubuntu. It should work fine on any linux distribution.
You wil need “unrar” and “vlc” or any other video player.
So, in Ubuntu, open a terminal and install these packages. Skip this step if you have allready installed the “unrar” and “vlc” packeges.
sudo apt-get install unrar vlc
Then issue the fallowing command:
unrar p -inul /example/path/to/Some.Scene.Release/some.sr.r00 | vlc -
What the command does:
unrar = starts unrar
p = outputs the extraction data of the file
-inul = disables error messages
/example/path/to/Some.Scene.Release/some.sr.r00 = path to one of the scene release’s rar files
| vlc – = pipes the output of the extraction into vlc that starts to play the output, and therefore plays the video file that is within the rar files. Don’t forget the ending “-“, or it won’t work. You can use another video player if you want, just replace “vlc” with what you want. I have only tested this with vlc and mplayer.
One bad thing with this trick is that you can only pause and play the file, but not rewind or fast forward.
Clean up Ubuntu!
Clean up Ubuntu!
How to clean up your Ubuntu.
01. Getting rid of Residual Config packages
In Synaptic Package Manger, there is a built-in feature that gets rid of old
Residual Config packages. Residual Config packages are usually dependency
packages that are left behind after you uninstall a package from your machine.
To use this feature, go to System > Administration > Synaptic Package Manager.
On the bottom left hand corner of the window, click the Status button. In the
list above the Sections, Status, Search, and Custom buttons, you should see the
following text:
Quote:
1 2 3 4 |
Installed Installed (local or obsolete) Not installed Residual config |
Click on the “Residual config” text. (If the “Residual config dialogue does not
appear, that means you do not have any Residual Config packages on your machine
and you can skip this step.) Do you see the packages that popped up in the
window on the right? Those are the Residual Config packages. To get rid of these
pests, click on the box to the left of the package name and select “Mark for
Complete Removal”. After you have done that for all of the Residual Config
packages, look at the top of the Synaptic Package Manger window. Do you see the
green check mark with the text “Apply” right under it? Click that button, and
you’ll flush all those Residual Config packages down the toilet!
02. Getting rid of partial packages
This is yet another built-in feature, but this time it is not used in Synaptic
Package Manager. It is used in the Terminal. To access the Terminal, go to
Applications > Accessories > Terminal. Now, in the Terminal, key in the
following command (or you can just copy and paste from here):
1 |
sudo apt-get autoclean |
Enter your password when prompted and press Enter. See the package names that
appeared in the Terminal? Those were partial packages that have just been
deleted. Say goodbye! That’s it! This command deletes the
not-so-fully-downloaded packages that you acquire when a package that is being
downloaded is suddenly cancelled. This is my favorite little trick when it comes
to getting rid of junk files.
03. Getting rid of unnecessary locale data
For this tip, you need to download the “localepurge” package found in Synaptic
Package Manager. “localepurge” is just a simple script to recover diskspace
wasted for unneeded locale files and localized man pages. It will automagically
be invoked upon completion of any apt installation run.
To open Synaptic Package Manager, follow the instructions in step 1. After
opening up Synaptic Package Manager, click the Sections button on the bottom
left hand corner of the window, if it is not already clicked. Next, at the top
of the Synaptic Package Manager window, click the Search button. In the search
window, key in the following text :
1 |
localepurge |
Did the “localepurge” package popup in the package window? It probably did,
unless you do not have the correct Repositories. Now, click on the box next to
the “localepurge” package name. Click on Mark for Installation. Now click the
Apply button at the top of the window and wait for the downloading and
installing of the “localepurge” package to finish. Once it is done, a new window
should popup that has a bunch of abbreviations on it. for example:
1 2 3 4 5 6 |
en fr po sp ka etc... |
You want to select the abbreviation of the language that you speak, or use with
Ubuntu, ignoring the capitalized ones. For example, I speak english, so I would
select the “en” abbreviation. A french speaker would select the “fr”
abbreviation. So on and so forth… Then click next. All done!
04. Getting rid of “orphaned” packages
For this tip, you need to download the “deborphan” package found in Synaptic Package Manager.
“deborphan” finds “orphaned” packages on your system. It determines which packages have no
other packages depending on their installation, and shows you a list of these
packages. It is most useful when finding libraries, but it can be used on
packages in all sections…
To open Synaptic Package Manager, follow the instructions in step 1. After
opening up Synaptic Package Manager, click the Sections button on the bottom
left hand corner of the window, if it is not already clicked. Next, at the top
of the Synaptic Package Manager window, click the Search button. In the search
window, key in the following text :
Quote:
1 |
deborphan |
Did the “deborphan” package popup in the package window? It probably did, unless
you do not have the correct Repositories. Now, click on the box next to the
“deborphan” package name. Click on Mark for Installation. Now click the Apply
button at the top of the window and wait for the downloading and installing of
the “deborphan” package to finish. Once that is done, open up the Terminal.
Instructions for doing that are located in Tip #2. After you have gotten the
Terminal open, key in the following command (or copy and paste from here):
Code:
1 |
sudo deborphan | xargs sudo apt-get -y remove --purge |
Enter your password when prompted and press Enter. See the package names that
appeared in the Terminal? Those were orphaned packages that have just been
deleted. Say goodbye! This is my second favorite way of dealing with junk files.
05. Adding a “Find orphaned packages” to Synaptic Package Manager
This is not really much of a tip on how to get rid of junk files. It’s more like
adding a “deborphan” shortcut to Synaptic Package Manager so that you don’t have
to use the Terminal to find “orphaned” packages.
Please note: You must have the “deborphan” package installed or else this will
not work.
To start this out, open up Synaptic Package Manager with the instructions from
step 1. Now, at the top of the Synaptic Package Manager window, click the
Settings button, followed by the Filters button. In the Filters window, on the
bottom left hand corner, push the New button. You can name the new Filter if you
like, but it is not necessary. I named mine “Orphaned”. With your new Filter
selected, in the “Status” tab on the right, click the Deselect All button. Next,
check the “Orphaned” option under the “Other” category. Then click the OK
button.
To use this new filter, click the Custom button on the bottom left hand corner
of the Synaptic Package Manager window. You should see the following text, or
something similiar :
Quote:
1 2 3 4 5 |
Broken Marked Changes (Whatever you named your "deborphan" Filter) Package with Debconf Search Filter |
Click on the “(Whatever you named your “deborphan Filter)” text. Do you see the
packages that popped up in the window on the right? Those are the “orphaned”
packages. To get rid of these buggers, click on the box to the left of the
package name and select “Mark for Complete Removal”. After you have done that
for all of the “orphaned” packages, look at the top of the Synaptic Package
Manger window. Do you see the green check mark with the text “Apply” right under
it?
Click that button, and you’ll get rid of all the “orphaned” packages forever.
Rebuilding the font cache
If you install a new font in linux, you need to rebuild the fonts cache:
sudo fc-cache -f -v
How-To create a MySQL database and set privileges to a user
MySQL is a widely spread SQL database management system mainly used on LAMP (Linux/Apache/MySQL/PHP) projects.
In order to be able to use a database, one needs to create: a new database, give access permission to the database server to a database user and finally grant all right to that specific database to this user.
This tutorial will explain how to create a new database and give a user the appropriate grant permissions.
For the purpose of this tutorial, I will explain how to create a database and user for the music player Amarok. In order to index its music collection, Amarok quand use a mysql backend.
The requirement for this set up is to have access to a database. We are going to create a database called amarok which will be accessible from localhost to user amarok idetified by the password amarok….
Obviously, we need to to have a mysql server installed as well as amarok:
sudo apt-get install mysql-server amarok
On a default settings, mysql root user do not need a password to authenticate from localhost. In this case, ou can login as root on your mysql server using:
mysql -u root
If a password is required, use the extra switch -p:
mysql -u root -p
Enter password.
Now that you are logged in, we create a database:
mysql> create database amarokdb;
Query OK, 1 row affected (0.00 sec)
We allow user amarokuser to connect to the server from localhost using the password amarokpasswd:
mysql> grant usage on *.* to amarokuser@localhost identified by 'amarokpasswd';
Query OK, 0 rows affected (0.00 sec)
And finally we grant all privileges on the amarok database to this user:
mysql> grant all privileges on amarokdb.* to amarokuser@localhost ;
Query OK, 0 rows affected (0.00 sec)
And that’s it. You can now check that you can connect to the MySQL server using this command:
mysql -u amarokuser -p'amarokpasswd' amarokdb
HOWTO: Create a FTP server with user access (proftpd)
A. The GUI way (for beginners only)
For those who are new to linux and don’t want to use a FTP server without GUI, or just for those who don’t use often their FTP server and wish to set it
quickly without a high level of security, there is a GTK GUI for proftpd.
Be careful, it’s less secure than configuring yourself your server.
1. Install proftpd and gproftpd with synaptic or with this command:
Code:
1 |
sudo apt-get install proftpd gproftpd |
2. Play with the GUI and set up quickly your server.
Feel free to post here if you have some problems with gproftpd but it shouldn’t be too hard to use (it took me 2 minutes to set up a small FTP server ).
B. The secure way
1. Install proftpd with synaptic or with this command:
Code:
1 |
sudo apt-get install proftpd |
2. Add this line in /etc/shells file (sudo gedit /etc/shells to open the file):
Code:
1 |
/bin/false |
Create a /home/ftp directory:
Code:
1 2 |
cd /home sudo mkdir ftp |
Create a user named ftp_user which will be used only for ftp access. This user don’t need a valid shell (more secure) therefore select /bin/false shell
for ftp_user and /home/ftp as home directory (property button in user and group window).
To make this section clearer, i give you the equivalent command line to create the user, but it would be better to use the GUI (System -> Administration -> User -> Group) to create the user since users here often got problems with the user creation and the password (530 error) with the command line, so i really advice to use the GUI :
Code:
1 2 |
sudo useradd ftp_user -p your_password -d /home/ftp -s /bin/false sudo passwd ftp_user |
In ftp directory create a download and an upload directory:
Code:
1 2 3 |
cd /home/ftp/ sudo mkdir download sudo mkdir upload |
Now we have to set the good permissions for these directories:
Code:
1 2 3 4 5 |
cd /home sudo chmod 755 ftp cd ftp sudo chmod 755 download sudo chmod 777 upload |
3. OK, now go to the proftpd configuration file:
Code:
1 |
sudo gedit /etc/proftpd/proftpd.conf |
and edit your proftpd.conf file like that if it fit to your need:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# To really apply changes reload proftpd after modifications. AllowOverwrite on AuthAliasOnly on # Choose here the user alias you want !!!! UserAlias sauron userftp ServerName "Server_Name" ServerType standalone DeferWelcome on MultilineRFC2228 on DefaultServer on ShowSymlinks off TimeoutNoTransfer 600 TimeoutStalled 100 TimeoutIdle 2200 DisplayFirstChdir .message ListOptions "-l" RequireValidShell off TimeoutLogin 20 RootLogin off # It's better for debug to create log files ExtendedLog /var/log/ftp.log TransferLog /var/log/xferlog SystemLog /var/log/syslog.log #DenyFilter \*.*/ # I don't choose to use /etc/ftpusers file (set inside the users you want to ban, not useful for me) UseFtpUsers off # Allow to restart a download AllowStoreRestart on # Port 21 is the standard FTP port, so you may prefer to use another port for security reasons (choose here the port you want) Port 1980 # To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 8 # Set the user and group that the server normally runs at. User nobody Group nogroup # Umask 022 is a good standard umask to prevent new files and dirs # (second parm) from being group and world writable. Umask 022 022 PersistentPasswd off MaxClients 8 MaxClientsPerHost 8 MaxClientsPerUser 8 MaxHostsPerUser 8 # Display a message after a successful login AccessGrantMsg "welcome !!!" # This message is displayed for each access good or not ServerIdent on "you're at home" # Set /home/ftp directory as home directory DefaultRoot /home/ftp # Lock all the users in home directory, ***** really important ***** DefaultRoot ~ MaxLoginAttempts 5 #VALID LOGINS AllowUser userftp DenyALL </Limit> <Directory /home/ftp> Umask 022 022 AllowOverwrite off <Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD> DenyAll </Limit> </Directory> <Directory /home/ftp/download/*> Umask 022 022 AllowOverwrite off <Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD> DenyAll </Limit> </Directory> <Directory> /home/ftp/upload/> Umask 022 022 AllowOverwrite on <Limit READ RMD DELE> DenyAll </Limit> <Limit STOR CWD MKD> AllowAll </Limit> </Directory> |
Ok you have done proftpd configuration. Your server is on port 1980 (in this exemple) and the access parameters are
user: ftp_user
password: the one you’ve set for ftp_user
4. To start/stop/restart your server:
Code:
1 2 3 |
sudo /etc/init.d/proftpd start sudo /etc/init.d/proftpd stop sudo /etc/init.d/proftpd restart |
To perform a syntax check of your proftpd.conf file:
Code:
1 |
sudo proftpd -td5 |
To know who is connected on your server in realtime use “ftptop” command (use “t” caracter to swich to rate display), you can also use the “ftpwho”
command.