LoginSignup
1
1

More than 5 years have passed since last update.

Linux memo

Last updated at Posted at 2016-02-17

diagnosis

smtp-auth

from smtplib import SMTP
smtp = SMTP('smtp.ecample.com')
smtp.login('<user>','<pass>')

(235, b'2.7.0 Authentication successful')

user/group

menber add to group

usermod -aG [GROUPS] [USER]

filesystem

Extend xfs file system

Install tools

yum install xfsprogs

Then use the following command, substituting the mount point of the file system (XFS file systems must be mounted to resize them):

xfs_growfs -d /mnt/xvdf

cron / anacron

anacron

/etc/anacrontab

anacron ctrl /etc/cron.(dayly|weekly|monthly)

/etc/cron.hourly is kicked by cron.

/etc/cron.d/0houry -> /etc/cron.houry.

cron.houry = 01 * * * * root run-parts /etc/cron.hourly

ssh

Port forwarding

To [server]'s 80
ssh -L 9001:localhost:80 [server]

To other server's 80.
ssh -L 9001:[other-server]:80 [server]

Reverse port forwarding

ssh -R 8000:localhost:8000 [server]
[server] listen 8000 and forward local-pc's 8000.
This command [server] listen localhost:8000 only. If you want to listen 0.0.0.0[server], edit 'sshd_conf' and reboot sshd daemon.
http://superuser.com/questions/588591/how-to-make-ssh-tunnel-open-to-public

GatewayPorts yes

and connect with -g option.

ssh -g -R 8000:[other-server]:8000 [server]

apply sysctl.d

for amzn-linux

. /etc/init.d/functions
apply_sysctl

delete file start with '-'

use -- option.

touch -- -hoge
cp -- -hoge hoge
rm -- -hoge
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1