快速创建sftp用户脚本
来源:原创
时间:2023-02-15
作者:脚本小站
分类:SHELL
#!/bin/bash export USERNAME=$1 export PASSWORD=`pwgen 20 1` if [ -z $USERNAME ];then echo 'enter one user name' exit fi mkdir /algodata/$USERNAME if [ $? -ne 0 ]; then exit fi useradd $USERNAME -s /sbin/nologin -d /algodata/$USERNAME/$USERNAME cat >> /etc/ssh/sshd_config <<EOF Match User $USERNAME X11Forwarding no AllowTcpForwarding no PermitTTY no ForceCommand internal-sftp ChrootDirectory /algodata/$USERNAME EOF systemctl reload sshd.service echo $PASSWORD | passwd --stdin $USERNAME echo 'username: '$USERNAME echo 'password: '$PASSWORD
- shell编程,将循环输出的结果重定向到文件,将文件内容输入重定向到循环
- shell常用函数
- nexus nexus3安装
- docker部署elk mysql redis rabbitmq mongo nacos minio jaeger
- shell编程,在脚本中使用函数,局部变量,传参,返回值,递归,引入库source,shtool函数库安装使用
- shell编程,while循环,until循环命令
- 批量安装node_exporter脚本
- shell编程,对bash脚本进行语法检测
- 快速创建sftp用户脚本
- shell编程,桌面环境中的脚本,select命令,dialog包的使用,kdialog、gdialog、zenity