Category: Linux

  • Upload all files to FTP server using lftp

    lftp allow you to upload all files and sub folders using single command. With normal ftp command, you need to use put/mput command many times to do the same.

    To download all files from FTP server, use “mirror” command. mirror command also allow you to upload files to remote server by specifying -R (reverse mirror) option.

    This is very useful for uploading files from SSH shell account.

    For help, use ? in lftp command prompt. To get help for specific command use

    help 
    

    Exampe

    help mirror
    

    To upload all files from local folder to remote server, run

    lftp -d -u FTP_USER,FTP_PASSWORD FTP_SERVER_IP
    set ftp:ssl-allow no
    mirror -R /var/flashwebhost/vshare2.7/ public_html
    

    Following will upload vshare2.7 folder to FTP root folder.

    unzip vshare2.7.zip
    lftp -d -u FTP_USER FTP_SERVER_IP
    set ftp:ssl-allow no
    mirror -R vshare2.7
    

    See lftp

  • chmod recursive with lftp

    lftp is a command line FTP program with several advanced options.

    To chmod all files and folders inside a sub folder, you can use -R option.

    chmod -R 777 modules
    

    This will chmod all files and subfolders inside the folder “modules” to 777.

    See lftp

  • lftp enable debug mode

    To enable debug mode, add -d to command line like

    lftp -d -u bizhat,UdddaaaaaartN 174.36.192.112
    

    See lftp

  • Download all files from FTP server using lftp

    lftp is a command line FTP client, that can be used to download all files from a remote FTP server to local folder.

    This is useful when you want to move migrate site from one server to another.

    To download all files from FTP server, create an empty folder and change to it.

    mkdir ~/sok-move
    cd ~/sok-move
    

    Run lftp command to connect to remove FTP server.

    lftp -u FTP_SERVER_USER,'FTP_SERVER_PW' FTP_SERVER_IP
    

    This will connect you to FTP server. Run following 2 commands as needed. First command will disable SSL, this is required if remote FTP server have no SSL installed. Second command will enable active FTP mode, will be useful if passive FTP don’t work for you.

    set ftp:ssl-allow false
    set ftp:passive-mode off
    set ssl:verify-certificate no
    

    Change the folder that you need to download and run

    mirror
    

    This will download everything from remote FTP server to your local folder.

    You can use options

    mirror -c --parallel=10
    

    Here -c is for continue, will help with resume if you get disconnected or want to mirror again.

    –parallel=10 will tell lftp to download 8 files in parallel instead of files one by one.

    See lftp

  • Install vnstat on CentOS 7

    To install vnstat on CentOS 7, run

    yum install vnstat -y
    

    Now create database for your network interface card

    vnstat --create -i NETWORK_INTERFACE_NAME
    

    Restart vnstat deamon

    systemctl restart vnstat
    

    See vnstat

  • Install RabbitMQ on Ubuntu/Debian

    To install rabbitmq on Ubuntu/Debian, run

    echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
    wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
    apt update
    apt install rabbitmq-server
    

    To start RabbitMQ server, run

    service rabbitmq-server start
    
  • Install ansible on Ubuntu

    To install ansible on Ubuntu, run

    apt-get -y update
    apt-get -y install software-properties-common
    apt-add-repository ppa:ansible/ansible -y
    apt-get -y update
    apt-get -y install ansible
    
  • Install Transmission on CentOS

    Install Transmission on CentOS

    transmission is a torrent client. This come with a web GUI, that make it easy to installed on a remote server with no X-Windows. To install transmission on CentOS server, run

    yum install -y transmission-daemon transmission-cli
    

    Allow Web Access

    To access transmission web GUI, you need to white list your IP address. To do this, first stop tranmission

    service transmission-daemon stop
    

    Edit file

    vi /var/lib/transmission/.config/transmission/settings.json
    

    Find

        "rpc-whitelist": "127.0.0.1",
    

    Replace with

        "rpc-whitelist": "127.0.0.1,YOUR_IP_ADDR_HERE",
    

    YOUR_IP_ADDR_HERE – replace with your actual IP address.

    Start transmission

    service transmission-daemon start
    

    You will be able to access web GUI at

    http://YOUR_SERVER_IP:9091
    

    Downloaded files are stored in folder

    /var/lib/transmission/Downloads