Labels

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, August 28, 2014

How I can limit Download/Upload bandwidth on ubuntu server?

> Entire OS.
> One network interface.
> Single application.

qus 1 : How I Manage Bandwidth Using Trickle On Ubuntu ?
Trickle it’s available on Ubuntu Software Repository, to install trickle you can install via Ubuntu Software Center or install via terminal by typing command: 

# sudo apt-get install trickle

Basic Use Trickle
# trickle -d download-bandwidth -u upload-bandwidth command
   
See Example: Limit the download bandwidth at 256Kbps for wget
# trickle -d 100 wget http://mirror.dhakacom.com/ubuntu-releases/14.04.1/ubuntu-14.04.1-desktop-amd64.iso

qus 2 : How I Manage Bandwidth Using wondershaper On Ubuntu ?
wondershaper it’s available on Ubuntu Software Repository install via terminal by typing command:

# apt-get install wondershaper
   
Basic Use wondershaper
# wondershaper Interface name  download-bandwidth upload-bandwidth command

See Example: Limit the download bandwidth at 1024Kbps and upload 512kbps
# wondershaper eth0 1024 512

Monday, June 23, 2014

How to Allow root to use SSH on Ubuntu 14.04

Ubuntu is Debian-based distributions that don’t allow logins by the root user by default, either locally or remotely via SSH. Now i discussed how to enable root login on Ubuntu 14.04

1. Login using normal user and su to root. Edit /etc/ssh/sshd_config :
user@Ubuntu14.04:~# su -root
Password:
root@Ubuntu14.04:~# vim /etc/ssh/sshd_config


2. Comment out #PermitRootLogin without-password, add PermitRootLogin yes into the line[28] :

# Authentication:
LoginGraceTime 120
#PermitRootLogin without-password
PermitRootLogin yes
StrictModes yes

3. Restart ssh service to take affect :
root@Ubuntu14.04:~# service ssh restart
ssh stop/waiting
ssh start/running, process 1499
root@Ubuntu14.04:~#


4. That’s all.

Tuesday, October 22, 2013

How can I reset my MySQL password?

How can I reset my MySQL password?

1. Stop the mysql demon process using this command :
root@web_01: sudo /etc/init.d/mysql stop

2. Start the mysqld demon process using the --skip-grant-tables option with this command
root@web_01: sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

3. start the mysql client process using this command
root@web_01: mysql -u root

4. from the mysql prompt execute this command to be able to change any password
mySql> FLUSH PRIVILEGES;

5. Then reset/update your password
mySql> SET PASSWORD FOR root@'localhost' = PASSWORD('password');

6. Then stop the mysqld process and relaunch it with the classical way: 
root@web_01: sudo /etc/init.d/mysql stop
root@web_01: sudo /etc/init.d/mysql start
OR
root@web_01: sudo /etc/init.d/mysql restart



Enjoy .......
---------------------------------------------------------------------
How can I reset my MySQL password?
change mySql password
how to change MySQL password?

Thursday, August 1, 2013

How to install Progress bar for terminal

root@SoftwareDepo:/home/$ apt-get install pv

root@SoftwareDepo:/home/$ pv bigfile > /mnt/ghost_on_windows_box/bigfile

Here is the output looked like, at three different stages:

205MB 0:00:17 [8.03MB/s] [=======>                           ] 25% ETA 0:00:49
436MB 0:00:31 [40.7MB/s] [=================>                 ] 54% ETA 0:00:25
801MB 0:00:44 [  18MB/s] [=================================>] 100% ETA 0:00:00


Enjoy......

Friday, June 28, 2013

How to remove delta search from mozilla new tab

(1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button promising to be careful.

(2) In the filter box, type or paste newtab and pause while the list is filtered

(3) Double-click the browser.newtab.url preference and enter the desired value:

Press Ctrl+t to open a new tab and verify that it worked. Fixed?


Thursday, June 20, 2013

How to : Configure a simple Debian gateway

More people requisite to use a dedicated Debian machine as a gateway for a LAN, this has many benefits compared to using a dedicated hardware firewall.

Overview
In this tutorial, we create 1 files and change 6 other files for testing our Debian Gateway.
1. Configure IP address information
2. Configure dns address
3. Modify Source list
4. Install Basic Packages
5. Create a file; NAT and basic firewall with iptables
6. Permission created file.
7. Modify startup file.
8. Reboot server or Run created file.


Steps
1. Configure IP address information : vim.tiny /etc/network/interfaces
2. Configure dns address : vim.tiny /etc/resolv.conf
3. Modify Source list : vim /etc/apt/sources.list
4. Install Basic Packages : apt-get update.
5. Create a file; NAT and basic firewall with iptables : vim /usr/bin/nat_firewall.sh
6. Permission created file : using chmod
7. Modify startup file : vim /etc/rc.local
8. Reboot server



Sunday, May 5, 2013

How to Install Python 2.7

Download Python : Below the following commands to download and extract Python 2.7 to your hosting account.

# mkdir ~/python
# cd ~/python
# wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
# tar zxfv Python-2.7.2.tgz
# find ~/python -type d | xargs chmod 0755
# cd Python-2.7.2

Friday, April 5, 2013

Install GUI in Ubuntu Server

If you are a new user and not familiar with command prompt you can install GUI for your ubuntu server using the 2 options

1) Install desktop Environment
2) Install Webmin



1) Install desktop Environment
        First you need to make sure you have enabled Universe and multiverse repositories in /etc/apt/sources.list file once you have enable you need to use the following command to install GUI
   
    root@server# sudo apt-get update
    root@server# sudo apt-get install ubuntu-desktop 
 
         ** The command will install GNOME desktop
   
If you want to install a graphical desktop manager without some of the desktop addons like Evolution and OpenOffice, but continue to use the server flavor kernel use the following command
    root@server# sudo aptitude install --without-recommends ubuntu-desktop
   
If you want to install light weight desktop install xfce using the following command
    root@server# sudo apt-get install xubuntu-desktop
   
If you want to install KDE desktop use the following command
    root@server# sudo apt-get install kubuntu-desktop
   

Tuesday, February 19, 2013

Chroot vsftpd on CentOS 6

We learn here's how to setup chroot vsftpd on CentOS 6. The need was for FTP users to be able to upload to their own directories inside /var/www/html/uploads/; if you want to another location, you can; I had to make sure user weren't able to login via ssh and that the web application had accessed the files they uploaded.

Install :

root@allnewspaper.info:~# Yum –y install vsftpd

Vsftpd :

For vsftpd. conf, set or uncomment the following:

root@allnewspaper.info:~# vim /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

The /etc/vsftpd/chroot_list has to exist, so create it:

root@allnewspaper.info:~# touch /etc/vsftpd/chroot_list

Now the vsftpd daemon can be started, so:

root@allnewspaper.info:~# chkconfig vsftpd on
root@allnewspaper.info:~# service vsftpd start

vsftpd allow without shell

So, I had to make sure that the accounts created didn't have ssh shell access. That means that when adding new users, I had to set their shell to /bin/false. But then vsftpd will not allow them to login as well. The solution is to remove the PAM (Pluggable authentication module) requirement to have a shell for vsftpd. Edit /etc/pam.d/vsftpd, and comment out the following line:

auth required pam_shells.so

To become:

#auth required pam_shells.so

skel and default directory permission

I needed the directories to have some other default directories in them. So I created a new directory for the skeleton in /etc/skel-ftp:

root@allnewspaper.info:~# mkdir /etc/skel-ftp

and put the stuff I needed default there (mostly just other directories for the web application to move the uploaded files to depending on if it was successful or not). I also needed the directory permissions to be 775, so I edit /etc/login.defs . Specifically I set the UMASK variable to 002:

UMASK 002

SELinux

We need to allow users to upload to their home directories as well as allow vsftpd to get full write access since we're allowing users to upload to the /var/www/html directory. So:

root@allnewspaper.info:~# setsebool -P allow_ftpd_full_access=on
root@allnewspaper.info:~# setsebool -P ftpd_home_dir=on

Adding new users

So with all the preparation done, we need the specific command for adding new users. Some notes and reminders:

  • Users' home directories are located in /var/www/html/uploads/ .
  • Users must not have ssh shell access.
  • Users home directories needed some default stuff in them. We'll get these from /etc/skel-ftp/ .
  • The user had to be part of the Apache group (this is somewhat a security risk, I believe). The web application has to parse the files uploaded, after which they'll be moved to a specific directory inside the user's home directory.

root@allnewspaper.info:~# useradd -m -k /etc/skel-ftp/ -b /var/www/html/uploads/ -g apache -s /bin/false USERNAME

Of course, set a password for the user after creating it:

root@allnewspaper.info:~# passwd USERNAME

That's it!
Thanks

Monday, February 4, 2013

How to : Vsftpd FTP Server With Virtual Users

Install vSftpd.rpm
----------------------------------------------------------------------------------------------------------
[root@localhost ~]# cat /etc/*release*                                       // Check centos Version
[root@localhost ~]# rpm -Uvh vsftpd-2.0.5-24.el5.i386.rpm  // centos version pkg
[root@localhost ~]# service vsftpd restart                               // service restart
[root@localhost ~]# netstat -ant                                               //
[root@localhost ~]# cd /etc/vsftpd/                                          //
[root@localhost ~]# cp vsftpd.conf vsftpd.conf.org               //
[root@localhost ~]# vim vsftpd.conf                                       // Change Files, follow bellow Lines


    # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
    anonymous_enable=NO
    #
    # Uncomment this to allow local users to log in.
    local_enable=YES
    #
[root@localhost ~]# service vsftpd restart

||| Create FTP User
[root@localhost ~]# adduser -c 'FTP USER blink' -m blink
[root@localhost ~]# passwd blink

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CHECK YOUR FTP OK or Not OK |||||||
-------------------------------------------------

|With Filezilla
|| host         : 192.168.153.242            // your server ip address
|| username        : blink                        //
|| Password        : blink                        //

| With ssh
|| ftp 192.168.153.242                         // command line windows & linux machine


|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Commonly used FTP commands||||||||||
---------------------------------------------
    ls: directory listing equivalent to dir.
    ls -l: long directory listing, more detail.
    pwd: display the name of current directory.
    cd: change directory.
    lcd: change the local current directory.
    get: to download the file from the FTP server.
    put: to transfer file and place it on the FTP server.
    mget: to download multiple files from the FTP server.
    mput: to transfer multiple files to the FTP server.
    prompt: to turn on/off interactive mode.
    binary: to turn on binary mode.
    ascii: to turn on ascii mode.
    delete: to turn a file on FTP server.
    status: to display how the current FTP session is configured.
    mkdir: to make directory on FTP server.
    quit/close/bye/disconnect: to disconnect from the FTP server.

Wednesday, January 23, 2013

How to Bonding in CentOS

### Bonding in CentOS ###
[root@localhost ~]# yum install ethtool -y
[root@localhost ~]# vim /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1

[root@localhost ~]# touch /etc/sysconfig/network-scripts/ifcfg-bond0
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=172.16.10.1
NETMASK=255.255.255.0
NETWORK=172.16.10.0
BROADCAST=172.16.10.255
GATEWAY=172.16.10.1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
HWADDR=00:19:CB:54:A9:83
USERCTL=no
MASTER=bond0
SLAVE=yes

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth2DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
HWADDR=F4:EC:38:82:7C:64
USERCTL=no
MASTER=bond0
SLAVE=yes

modprobe bonding
service network restart



How-To create a MySQL database and set privileges to a user

########## Creating A Database & Database user [tweecart]
Login : server

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 tweecart_db;
    Query OK, 1 row affected (0.00 sec)
   
We allow user tweecart to connect to the server from localhost using the password tweecartpasswd:

    mysql> grant usage on *.* to tweecart@localhost identified by 'tweecartpasswd';
    Query OK, 0 rows affected (0.00 sec)
   
And finally we grant all privileges on the tweecart database to this user:
    mysql> grant all privileges on tweecart_db.* to tweecart@localhost;
    Query OK, 0 rows affected (0.00 sec)
   
Check : goto : http://domainname.com/phpmyadmin
User      : tweecart
Password : tweecartpasswd

===================================
In short : 
Login your Server : 

$ mysql -u root -p
    Enter password:

mysql> create database tweecart_db;
mysql> grant usage on *.* to tweecart@localhost identified by 'tweecartpasswd';
mysql> grant all privileges on tweecart_db.* to tweecart@localhost;

Check : goto : http://domainname.com/phpmyadmin
User      : tweecart
Password : tweecartpasswd