Linux 日常总结
修改文件或文件夹所属用户及用户组
sudo chown gitlab-runner:gitlab-runner app-gate.jar
手动部署
cd /data/ebike/app-gate
sudo docker stop appgw-test
sudo rm -rf app-gate.jar
sudo rz
sudo docker cp /data/ebike/app-gate/app-gate.jar appgw-test:/app-gate/
sudo docker start appgw-test
连接mongodb
sudo docker run -it --rm --name mongo-test mongo mongosh 10.0.1.44:27017/ebike -u writer -p password
测试环境
sudo docker exec -it mongo /bin/bash
mongo 127.0.0.1:27017/ebike -u writer -p password
## mongo 导入数据
mongoimport -u writer -p password -d ebike -c ChargeStrategy --upsert ChargeStrategy.dat
连接redis
set相关命令: https://blog.csdn.net/qq_36777191/article/details/115527509
sudo docker run -it --rm --name redis-test redis:alpine redis-cli -h ebike-redis-prod.4nu26b.0001.apse1.cache.amazonaws.com -p 6379
sftp相关命令
sftp -oPort=2222 [email protected]:/
sudo docker run -it --rm --name mysql-test mysql:5.7 mysql -h ebike-aurora-prod-cluster-1.cluster-c0majbdrmayc.ap-southeast-1.rds.amazonaws.com -u root -P 3306 -p
scp相关命令
## 将本地文件上传bastion
scp jks-password.txt [email protected]:/home/zdj/
## 将bastion文件传到对应服务器
scp jks-password.txt zdj@uc-1:/home/zdj/
##-r 递归复制整个目录。
windows通过ftp上传文件:
1、打开需要上传文件所在的文件夹
2、打开cmd
3、登录:输入 ftp 回车 open soft.sxyd.cc 回车 user 回车 pwd
4、打开要上传的文件夹
5、上传:输入 put 本地文件名 服务文件名
新增用户
## 新增用户
sudo useradd -m -s /bin/bash username
## 切换角色并创建ssh文件夹
sudo su username
cd /home/username
mkdir .ssh
cd .ssh
##用rz命令把公钥上传到此文件夹
rz
## 改名为authorized_keys
mv id_rsa.pub authorized_keys
## 修改路径及文件的权限
chmod 700 /home/username
chmod 700 /home/username/.ssh
chmod 600 /home/username/.ssh/authorized_keys
chown -R username:username /home/username
## 赋予sudo权限
sudo visudo
## 在文件末尾添加一行
username ALL=(ALL:ALL) ALL
检测调用者的ip:
curl http://ip-api.com
PGP 加解密相关
GNU Privacy Guard (GnuPG) tool can be used for generating and managing the PGP keys. Note that
keys should be generated without a passphrase.
http://www.gnupg.org/
Example commands:
• Create a PGP key:
gpg --gen-key
• View the PGP key:
gpg -a --export
• Exports a public key to a file:
gpg --export -u 'UserName ' -a -o public.key
(or)
gpg --armor --export <keyid>
• Exports a private key to a file:
gpg --export-secret-keys -u 'UserName ' -a -o private.key
(or)
gpg --armor --export-secret-keys <keyid>
• Lists the private keys:
gpg --list-secret-keys DBS External API Gateway Customer Onboarding Guide Version 3.1
标签:username,ebike,keys,--,sudo,##,Linux,相关
From: https://www.cnblogs.com/myDong/p/17879420.html