Introduction In some of our earlier articles we’ve explained the setting up of chrooted sftp and chrooted ssh accounts along with the setup of an ftp server using vsftpd. In today’s automation driven enterprise infrastructure environments we may often find ourselves in situations where we need to automate the transfer of files using the ftp/sftp protocol. Setting up passwordless tranfer of files using sftp is farily stragithforward. Since sftp is based on the ssh protocol we can generate and use ssh keys to setup passwordless authentication to allow for automated file tranfers. In this article we will demonstrate three techniques using which you can automate the transfer of files using FTP protocol as well. Method 1: Using wget The wget command provides options to connect to the ftp server and download a file while specifying the credentials on the command line. In the below example, we connect to the ftp server with IP address 172.31.18.17 using the user name sahil and password as L#giN@123 and download the file download.txt. [root@sahilsuri0081 ~]# wget --user=sahil --password='L#giN@123' ftp://172.31.18.17/download.txt --2018-07-27 17:39:40-- ftp://172.31.18.17/download.txt => ‘download.txt’ Connecting to 172.31.18.17:21... connected. Logging in as sahil ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD not needed. ==> SIZE download.txt ... done. ==> PASV ... done. ==> RETR download.txt ... done. [ <=> ] 0 --.-K/s in 0s...Read More
Author: Sahil Suri
Introduction In one of our earlier articles, we explained the basics of syslog/rsyslog log management system in Linux and provided a quick demonstration on how we could modify the rsyslog configuration to redirect logs to a particular destination. Systemd maintains a binary log of services and programs that it manages in a system journal. This binary log is written to and managed by the systemd-journald service. The journalctl command provides an interface to users to be able to query this log and read messages from it. In this article, we will demonstrate with examples how you could use the journalctl command line interface to extract desired information from the systemd journal. Example 1: Using journalctl without any options When used without any accompanying options, the journalctl command will print the entire systemd journal log. This would present a lengthy output to the terminal screen and would prove to be rather tedious to interpret. Given below is a quick snippet from the log: [root@linuxnix ~]# journalctl -- Logs begin at Wed 2018-02-21 12:56:32 IST, end at Wed 2018-02-21 13:01:01 IST. -- Feb 21 12:56:32 linuxnix systemd-journal: Runtime journal is using 8.0M (max allowed 91.1M, trying to leave 136.6M free of 903.1M a Feb 21 12:56:32 linuxnix kernel: Initializing cgroup subsys cpuset Feb 21 12:56:32 linuxnix kernel: Initializing cgroup subsys cpu Feb 21 12:56:32 linuxnix kernel: Initializing cgroup subsys cpuacct Feb...Read More
Introduction In order to maintain overall operating system stability it is important to check that directories/file systems being used as temporary storage space by applications should get full. This is because a temporary file system out of space could cause a server to go into hung state and under extreme circumstances even a kernel panic might occur. Have you ever wondered why most files inside the /tmp directory get deleted over some time if they are left unused? If you have then this article is for you. In this article we will explain how and why the /tmp directory gets emptied over a period of time on Linux systems. We will explaining the concept on Centos 6/RHEL 6 systems. The mechanism is different in case of Centos 7/RHEL 7 systems. A program named tmpwatch is responsible for periodically cleaning up the /tmp and /var/tmp directories on Centos 6/RHEL 6 systems. tmpwatch recursively removes files which haven’t been accessed for a given time. Normally, it’s used to clean up directories which are used for temporary holding space such as /tmp. It does not follow symbolic links in the directories when it’s cleaning up the directory, will not switch file systems, skips lost+found and directories owned by the root user. The tmpwatch program should be installed on the system by default and you confirm the same by performing a query on...Read More
Take this course
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.