- non interactive ftp login:
$ ~/.netrc
Now you can simply ftp to said machine and it will auto-login.
machine server_name/ip
login username
password password
$ chmod 600 ~/.netrc
- Copying a file to the ftp server:
- echo put FILE.ext | ftp server_name
or - curl -T FILE.ext ftp://server_name --user username:password
- echo put FILE.ext | ftp server_name
Tuesday, October 8, 2013
Non interactive ftp for Linux users
FTP. Yes, people are still using it.
Wednesday, October 2, 2013
Checking your NIC is connected using bash
A simple yet effective way to test your network adapters connection status using command line.
Requires: ethtool
# ifconfig -a|grep eth|while read line;do echo ${line%% *} && ethtool ${line%% *}|grep Link;done
Requires: ethtool
# ifconfig -a|grep eth|while read line;do echo ${line%% *} && ethtool ${line%% *}|grep Link;done
Thursday, July 18, 2013
Slow ssh in RHEL/CentOS
It's everywhere and so it's also here, if ssh to Red Hat or CentOS takes forever, here's a quick fix:
# sed -i 's/^#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config
# sed -i 's/^#GSSAPIAuthentication no/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
# sed -i 's/^GSSAPIAuthentication yes/#GSSAPIAuthentication yes/g' /etc/ssh/sshd_config
# service sshd restart
Monday, May 6, 2013
BASH CLI turn monitor off / blank screen
So you want to get your screen blank or get your monitor into standby mode from the CLI?
Add the following to your .bashrc:
From there on, just use the command blank from your terminal.
Add the following to your .bashrc:
alias blank='sleep 1 && xset dpms force standby'
From there on, just use the command blank from your terminal.
Saturday, April 6, 2013
Quickly add rules to IPTABLES on CentOS/RHEL 5.x using a script
Older iptables lack the -C switch so you have to use bash to check whether a rule already exists before appending it. Works like this:
if [ ! "`iptables-save | grep 'dport 21'`" ]; then iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT;fiProbably not the most elegant solution, but it works.
if [ ! "`iptables-save | grep 'dport 22'`" ]; then iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT;fi
if [ ! "`iptables-save | grep 'dport 80'`" ]; then iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT;fi
service iptables save
Quickly disable SELinux in a setup script
So we all know how to disable SELinux manually, but what about doing so as part of a setup script?
Easy, got to love sed!
Easy, got to love sed!
Setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux && cat /etc/sysconfig/selinux
Repeat on /etc/selinux/config for Centos 7
Wednesday, February 20, 2013
Key exchange for passwordless rsync, scp, ssh...
There are so many answers out there but this is probably the best one I've seen:
http://troy.jdmz.net/rsync
http://troy.jdmz.net/rsync
Subscribe to:
Posts (Atom)