Random Linux

Linux, video games and web hosting

So you have downloaded a .deb file with a program that you would like to install. Most distros that are using a graphical interface will have a package manager that you can use to install these. But if you’re like me, you prefer to do it from the command line. To install it from there, you will need to use the dpkg command, using the -i flag, which does the install. In this example, I have dowloaded Google chrome for Linux from their website and am installing it on Ubuntu.

[email protected]:/home/user/Downloads# dpkg -i google-chrome-stable_current_i386.deb 

Selecting previously unselected package google-chrome-stable.
(Reading database ... 296976 files and directories currently installed.)
Unpacking google-chrome-stable (from google-chrome-stable_current_i386.deb) ...
Setting up google-chrome-stable (21.0.1180.79-r151411) ...
update-alternatives: using /usr/bin/google-chrome to provide /usr/bin/x-www-browser (x-www-browser) in auto mode.
update-alternatives: using /usr/bin/google-chrome to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode.
Processing triggers for man-db ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Processing triggers for menu ...

If that finishes with no errors, then the package should be installed. In this case, I can now open Google Chrome though the Window manager’s menu or through the terminal.

August 17th, 2012

Posted In: How To

Tags: , , , , , ,

One Comment

Samba is an open source software suite which provides file and print services. This can be installed using a few commands, or using our installation script at the bottom of this post.

 

The first thing that you need to do is install the Samba and samba-common packages.

sudo apt-get install samba samba-common

You will then want to make sure that python-glade2 is installed.

sudo apt-get install python-glade2

After that, you will want to install the Samba configuration tool.

sudo apt-get install system-config-samba

You then need to add a user account for the Samba user. You can use any name you would like.

sudo useradd sambauser

You will also want to create a user for you to log into your Samba server when you connect.

sudo smbpasswd -a sambauser

You will also want to run the Samba Configuration tool to set up the folders that you want to share. You can find that in your system’s app tray or you can start it by using the following command.

sudo system-config-samba

You are also able to download the installation script we created to help you automate installing that. This was tested on Ubuntu 12.04, so I cannot guarantee that it will work on anything but that. If you need it to work on your OS, let us know what you’re using and we’ll get a script set up for it.

Download the installation script here:

[wpdm_file id=4]

You need to make the permissions for this executable (something like chmod 755 installsamba.sh), then run:

sh installsamba.sh

Let us know how it works for you! If you like it and it helps you, feel free to share!

If you would like to see the source code for that, you can see it here:

installsamba.sh Source

Enjoy!

June 5th, 2012

Posted In: How To

Tags: , , , , , ,

One Comment

ClamAV is a popular malware scanner that can help to find malware on your accounts. You are able to find more information about that at the following link:

http://clamav.net

This software has many built in definitions that will find *most* of the malicious files under your accounts. It can find many shells, phishing sites and other malware. We won’t be able to cover all of the different options available in ClamAV in this article, but we will cover the parts that you will need to initially locate the malware so that it an be removed.

To install that, all you will need to do is run the following command.

If you are on a RedHat based OS, such as CentOS, you can install it with

yum install clamav

If you are using debian, you can use

apt-get install clamav

Once that is installed, you will want to run the freshclam command so that the definitions are updated to the most recent.

[email protected] [/home/user]# freshclam
ClamAV update process started at Thu Jan 12 04:41:48 2012
main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
daily.cld is up to date (version: 14300, sigs: 70715, f-level: 63, builder: guitar)
bytecode.cvd is up to date (version: 160, sigs: 38, f-level: 63, builder: edwin)

Then, you can use the clamscan command to run the scan. You will also want to use a couple of flags to only show the infected files, to search recursively, and to log your findings to a log file. The i limits the output to only infected files, the r flag means to recurse through the directoies and the l flag with a file name will log the scan to that file.

[email protected] [/home/user/public_html]# clamscan -ir -l log.txt

———– SCAN SUMMARY ———–
Known viruses: 1113857
Engine version: 0.97.3
Scanned directories: 139
Scanned files: 1602
Infected files: 0
Data scanned: 29.30 MB
Data read: 15.53 MB (ratio 1.89:1)
Time: 6.608 sec (0 m 6 s)

If a malicious file is found, it will show the path to the file and why it was flagged.

[email protected] [/home/user/public_html]# clamscan -ir -l log.txt
/home/user/public_html/thing.php: PHP.Shell-38 FOUND

———– SCAN SUMMARY ———–
Known viruses: 1113857
Engine version: 0.97.3
Scanned directories: 2412
Scanned files: 20511
Infected files: 1
Data scanned: 354.85 MB
Data read: 832.57 MB (ratio 0.43:1)
Time: 102.922 sec (1 m 42 s)

The output of the scan will also be logged to a file called log.txt if you run the command as it is in the example. You can then get the timestamps from that file and find the source, remove the file and patch the problem.

January 13th, 2012

Posted In: General

Tags: , , , , ,

Leave a Comment

To install ProFtp on CentOS, the first thing that you will want to do is to make sure that vsFTP is not already installed on your server.

[email protected][~]#yum remove vsftpd

Then, you will want to go into the /usr/src directory and download the latest version of ProFTP to that folder.

[email protected] [~]#cd /usr/src
[email protected] [/usr/src]# wget ftp://proftpd.mirrors.tds.net/pub/ProFTPD/distrib/source/proftpd-1.3.4rc1.tar.gz
–2011-03-07 03:25:48– ftp://proftpd.mirrors.tds.net/pub/ProFTPD/distrib/source/proftpd-1.3.4rc1.tar.gz
=> `proftpd-1.3.4rc1.tar.gz’
Resolving proftpd.mirrors.tds.net… 216.165.129.134
Connecting to proftpd.mirrors.tds.net|216.165.129.134|:21… connected.
Logging in as anonymous … Logged in!
==> SYST … done. ==> PWD … done.
==> TYPE I … done. ==> CWD /pub/ProFTPD/distrib/source … done.
==> SIZE proftpd-1.3.4rc1.tar.gz … 59791418
==> PASV … done. ==> RETR proftpd-1.3.4rc1.tar.gz … done.
Length: 59791418 (57M)

100%[===========================================================================================================================================================>] 59,791,418 1019K/s in 34s

2011-03-07 03:26:24 (1.66 MB/s) – `proftpd-1.3.4rc1.tar.gz’ saved [59791418]

Then, you will want to decompress the file.

[email protected][/usr/src]#tar -xzvf proftpd-1.3.4rc1.tar.gz

That should create a folder in the /usr/src named proftpd-1.3.4rc1. Go into that folder and we can configure and install it all with one line.

[email protected][/usr/src]#cd proftpd-1.3.4rc1
[email protected][/usr/src/proftpd-1.3.4rc1]#./configure && make && make install

And go back a folder and delete the proftp folder and the tar file. We won’t need those again.
[email protected][/usr/src/proftpd-1.3.4rc1]#cd ..
[email protected][/usr/src]#rm -rfv proftpd-1.3.4rc1 proftpd-1.3.4rc1.tar.gz

Once that is done, we will need to symlink the proftp binary to the /usr/sbin folder.

[email protected][/usr/src]#ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd

Once that is done, we will create the script in /etc/init.d to allow it to start at boot time.

[email protected][/usr/src]#nano /etc/init.d/proftpd

And paste this into that file:

#!/bin/sh
# $Id: proftpd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
#
# proftpd This shell script takes care of starting and stopping
# proftpd.
#
# chkconfig: – 80 30
# description: ProFTPD is an enhanced FTP server with a focus towards \
# simplicity, security, and ease of configuration. \
# It features a very Apache-like configuration syntax, \
# and a highly customizable server infrastructure, \
# including support for multiple ‘virtual’ FTP servers, \
# anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftp.conf
# pidfile: /var/run/proftpd.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = “no” ] && exit 0

[ -x /usr/sbin/proftpd ] || exit 0

RETVAL=0

prog=”proftpd”

start() {
echo -n $”Starting $prog: ”
daemon proftpd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd
}

stop() {
echo -n $”Shutting down $prog: ”
killproc proftpd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status proftpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/proftpd ]; then
stop
start
fi
;;
reload)
echo -n $”Re-reading $prog configuration: ”
killproc proftpd -HUP
RETVAL=$?
echo
;;
*)
echo “Usage: $prog {start|stop|restart|reload|condrestart|status}”
exit 1
esac

exit $RETVAL

Then save the file and exit. We will want to make that executable as well.

[email protected] [/usr/src]#chmod 755 /etc/init.d/proftpd

After that you will need to edit line 30 in /usr/local/etc/proftpd.conf and change the group to nobody.

[email protected] [/usr/src]#nano -w +30 /usr/local/etc/proftpd.conf

Then change that group line to say nobody. User should already say nobody when you open that file.

# Set the user and group under which the server will run.
User nobody
Group nobody

Also, if you would like your FTP users to be able to change the permissions of their files, you will want to comment out lines 39-42. So it should go from this:
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit>

to

# Bar use of SITE CHMOD by default
#<Limit SITE_CHMOD>
#  DenyAll
#</Limit>

Once that is done, all that we need to do is tell it to start on boot and start the ftp server. So, first you will run this.

[email protected] [/usr/src]#chkconfig –levels 235 proftpd on

Then finally, start the ftp server.

[email protected] [/usr/src]#/etc/init.d/proftpd start
Starting proftpd: [ OK ]

If you see the OK there, it should be started and ready to connect. Also to check on the status of the ftp server, you can run the following:

[email protected] [/usr/src]#service proftpd status
proftpd (pid 15853) is running…

Also, once it is in the /etc/init.d folder, you are able to start, stop and restart the FTP server with the service command, such as
service proftpd stop
service proftpd start
service proftpd restart
service proftpd status

March 7th, 2011

Posted In: How To

Tags: , , ,

Leave a Comment