ssh
1.删除已知hosts. ssh-keygen -R 192168.1.1
2.远程添加密钥免密登录 ssh-copy-id 192.168.1.1
composer
1.安装composer,php版本加载ssl扩展.
2.镜像,加载到composer.json里面
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
}
或者直接命令
composer config -g repo.packagist composer https://packagist.phpcomposer.com
3.secure-http(有时https报错时,把这个关了)
composer config secure-http false
or "secure-http":false,"
mysql
1.导入数据库 source database.sql
or mysql --defaults-extra-file="/tmp/tmpwgQtEZ/extraparams.cnf" --host=192.168.1.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=databasename < "/home/database.sql
2.导出数据库 mysqldump --opt -h 192.168.1.1 -u username -p password --skip-lock-tables databasename > database.sql
or mysqldump -h hostname -u username databasename > database.sql
3.用户管理
SHOW GRANTS FOR user;
查看用户的权限
CREATE USER test IDENTIFIED BY 'test';
创建用户
GRANT ALL PRIVILEGES ON \
databases`.* TO `database`@`%` 修改用户权限
DROP USER `test`@`%` 删除用户
GRANT ALL PRIVILEGES ON . TO 'test'@'%' IDENTIFIED BY PASSWORD 'test'; 直接创建用户并赋权限
UPDATE mysql.user SET password=PASSWORD('test') WHERE user='root'; FLUSH PRIVILEGES;` 修改用户密码
修改root管理员密码
修改 /etc/my.cnf 的 [mysqld] 添加 skip-grant-tables 然后重启 mysqld 无密码登录修改
ss
sudo apt-get install python-pip python-setuptools m2crypto
pip install shadowsocks
vim ~/shadowsocks.json
{
"server":"11.22.33.44",
"server_port":50003,
"local_port":1080,
"password":"123456",
"timeout":600,
"method":"aes-256-cfb"
}
sslocal -c ~/shadowsocks 2>&1 /tmp/sslog.txt
gfwlist ur: [https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt](https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt)
添加开机启动
sudo vim /etc/rc.local
firewall
- firewall-cmd --list-all
- firewall-cmd --list-all-zones 列出所有区域
- firewall-cmd --zone=public --list-all 公共区域
- firewall-cmd --get-defaut-zone 默认
- firewall-cmd --set-default-zone=external 扩展区域
- firewall-cmd --zone=trusted --change-interface=etho1 信任区域
firewalld的基本使用 启动\关闭\重启\状态\禁用
- firewalld:systemctl start\stop\restart\status\disable firewalld
启动\关闭\重启\状态\禁用一个服务:
-systemctl start\stop\restart\status\disable firewalld.service
追加服务:
- firewall-cmd --add(remove)-service=ssh\mysql\nginx\redis --zone=public --permanent
查看所有打开的端口:
- firewall-cmd --zone=public --list-ports
查看运行服务 :
- firewall-cmd --list-services --zone=public
更新防火墙规则:
- firewall-cmd --reload
查看区域信息: firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
添加端口
- firewall-cmd --zone=public --add-port=80/tcp(udp,icmp) --permanent
查看端口 firewall-cmd --zone= public --query-port=80/tcp
删除端口 firewall-cmd --zone= public --remove-port=80/tcp --permanent
网友评论