Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2917670
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: 系统运维

2015-12-14 16:15:57

1. sudo su -
2. 
useradd haha -m -s /bin/bash
3. passwd haha
4. usermod -a -G sudo haha
5.  deluser oleusername sudo
6. visudo
add following line under "root    ALL=(ALL:ALL) ALL"
haha  ALL=(ALL:ALL) ALL
7. log out, and log in.
deluser --remove-home olduser


1.  echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "hostname" >  /etc/hostname
1.1 vim /etc/hosts
change hostname;
1.2 vim /etc/rc.local
add following line:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
save and quit;
2. vim /etc/network/interfaces
change ip address and gateway
3.  vim /etc/ssh/sshd_config
change port to 1234
4. reboot server
5. Configure Iptables
iptables -L
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
 iptables -A INPUT -p tcp --dport *1234* -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -j DROP 

iptables -I INPUT 1 -i lo -j ACCEPT


iptables -I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
6. Save iptables configuration
iptables-save > /etc/iptables.rules
7. Configure iptables save automatically
vim  vim /etc/network/interfaces
add following content:
pre-up iptables-restore < /etc/iptables.rules
save and quit.
apt-get update
apt-get upgrade

阅读(2309) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~