Archive for the ‘Linux & Unix’ Category
Find the .deb package that contains a specific file on Ubuntu or Debian Linux
Sometimes you need to know to which debian or ubuntu package a specific file belongs, e.g. because you deleted a system file and want to reinstall it. There is a handy utility called apt-file which searches for a filename in all debian packages.
Installation
apt-get install apt-file
Usage example
search for the file /etc/sysctl.conf
apt-file search /etc/sysctl.conf
result:
apt-file search /etc/sysctl.conf
procps: /etc/sysctl.conf
mypc:~#
Now we see that the file is part of the debian / ubuntu package with the name “procps”.
How does Ubuntu’s screenshot tool Take Screenshot actually work?
The easiest way to make screenshots is to use Take Screenshot. You find it under Applications/Accessoires.
First change the delaytime for the screenshot from 0 to 1 or 2 seconds. This is the time you have to mark the chosen area. You should be fine with 1 second!
Then choose your screenshot option, e.g. Grab the current window. Klick on Take Screenshot and activate the window you need.
Take Screenshot closes. If all works well, a pop-up comes up to ask where to save the screenshot, which comes a s a .png.
For another screenshot you have to open the application again, so put it best in your panel.
The uncommon thing is that you have to run first Take screenshot and then choose an object, and not the other way round. That’s it!
How to install a professional image editing tool (KRITA) for Ubuntu 9.10
KRITA is a free image editing tool that ist pretty versatile and helps you not only to edit images, but also to use it for more artistic work on e.g. tablet PCs. It will surely remind you of Photoshop.
The easiest way to install KRITA is to download it over the Ubuntu Software Center. Do not take the complicated way to install it manually…
First go to Applications/Ubuntu Software Center:

Type in the searchfield KRITA and press Enter to mark KRITA for installation.
As KRITA appears, double click it, and then just klick on the Install button, start the installation and wait some seconds.

Now KRITA should appear checked as it has beeninstalled. That’s it!

How to enable active corners aka Exposé in Ubuntu 9.10 with Ubuntu Tweak
If you always wanted the Exposé effect on your Ubuntu Desktop, here you go! Active corners, known from Mac as Exposé, allow you e.g. to see all your open windows at once just by one mouse move into the corner of the desktop. Very useful if you are a multi-tasking god or goddess!
First open you terminal and copy & paste:
sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com FE85409EEAB40ECCB65740816AF0E1940624A220
Log in with your admin password and continue:
sudo gedit /etc/apt/sources.list
Then add the following lines at the end of the file:
deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/tualatrix/ppa/ubuntu karmic main
The source of Ubuntu tweak will be added to your repository. Updates for Ubuntu-Tweak will be installed automatically in future. Install Ubuntu-Tweak:
sudo apt-get update
sudo apt-get install ubuntu-tweak
Before using Ubuntu-Tweak, make sure you enabled visual effects for your desktop. Go to System/Preferences/Appearance an check under Visual Effects “Normal”.

Check your system tools for Ubuntu-Tweak, open it and go to Desktop, then to Compiz Fusion as you can see here:

Now you can enable a function for every corner, as you like. That’s it.
How to reset the administrator password in ISPConfig 3
If you lost your ISPConfig 3 administrator password, you can reset it with the following SQL query.
UPDATE sys_user SET passwort = md5(‘admin’) WHERE username = ‘admin’;
The SQL query sets the password to “admin” for the user “admin”, it has to be executed in the ISPConfig mysql database, e.g. with phpmyadmin. If you dont have phpmyadmin installed, then the query can be executed with the mysql commandline utility as well:
Login to the mysql database.
mysql -u root -p
and enter the password of the mysql root user. To switch to the ISPConfig database, run this command:
use dbispconfig;
Now execute the SQL command:
UPDATE sys_user SET passwort = md5(‘admin’) WHERE username = ‘admin’;
and close the mysql shell:
quit;
How to open winmail.dat files on Ubuntu and Debian Linux
The winmail.dat file is a container file format used by Microsoft Outlook to send attachments in richtext formatted emails. To open winmail.dat on Linux, use the tnef utility.
Installation
sudo apt-get install tnef
Usage
Open a shell window, navigate to the directory where the winmail.dat file is saved, then execute the command:
tnef winmail.dat
to extract all files that are stored in the winmail.dat into the current directory.
How to enable port 465 (smtps) in postfix mailserver
More and more internet access providers are closing port 25 to reduce spam except for connections to their own mailservers. If you run your own mailserver and have problems to connect to it on port 25, you can enable port 465 (smtps) in postfix as a workaround. Edit the /etc/postfix/master.cf file:
vi /etc/postfix/master.cf
and remove the # in front of the smtps line. Example for Debain 5, change the line:
#smtps inet n - - - - smtpd
to:
smtps inet n - - - - smtpd
and restart postfix:
/etc/init.d/postfix restart
How to prevent a Linux system user from loggin into the system
If a linux system user is able to login on the shell or with SSH depends on its shell setting in /etc/passwd. If you want to prevent that a certain user is able to login, then set the shell either to /bin/false or /sbin/nologin.
Example for Debian and Ubuntu Linux for the user with the username “otheruser”:
usermod -s /bin/false otheruser
For Redhat, Fedora or CentOS use /sbin/nologin:
usermod -s /sbin/nologin otheruser
Warning: Do not set the shell for the root user to /bin/false or /sbin/nologin!
How to prevent that a user deletes a file owned by root in its home directory
If the root user stores a file in the home directory of another user or any other directory that is owned by another user, this other user is able to delete the file even if the file is owned by root and has 700 permissions.
Example:
root@workstation:/home/otheruser# ls -la
total 8
drwxr-xr-x 2 otheruser otheruser 4096 Oct 23 11:52 .
drwxr-xr-x 3 root root 4096 Oct 23 11:51 ..
-rwx—— 1 root root 0 Oct 23 11:52 root_users_file
If I su now to “otheruser”, I’am able to delete the file as “otheruser” is the owner of the directory where “root_users_file” is stored:
root@workstation:/home/otheruser# su otheruser
sh-3.2$ rm root_users_file
rm: remove write-protected regular empty file `root_users_file’? y
sh-3.2$
Now to protect the file from beeing deleted, use the command chattr +i:
chattr +i root_users_file
and then try again to delete the file as “otheruser”, the action will be denied:
root@workstation:/home/otheruser# su otheruser
sh-3.2$ rm root_users_file
rm: remove write-protected regular empty file `root_users_file’? y
rm: cannot remove `root_users_file’: Operation not permitted
sh-3.2$
Now even root is not able to delete or edit the file anymore. With the command chattr -i the protection can be removed:
chattr -i root_users_file
How to reset the MySQL root password
The following steps describe the procedure to reset the mysql root password on Linux.
1) Stop the mysql server
/etc/init.d/mysql stop
2) Start the mysql server manually without permission tables which allows us to login as root user without password:
mysqld_safe –skip-grant-tables &
3) Login into mysql as root user without a password and switch to the “mysql” database:
mysql -u root mysql
Then execute this SQL query to set a new password for the mysql root user:
update user set Password=PASSWORD(‘mynewpassword’) WHERE User=’root’;
(Replace “mynewpassword” with the new root password in the above command).
Then logout from the mysql prompt by typing:
exit
4) Now bring back the running mysql instance into the foreground by typing:
fg
and then press [ctrl] + c to kill the mysql process.
5) Start the mysql server again:
/etc/init.d/mysql start

