最新发布第15页
排序
剪贴板安装小记
需要安装以下模块djangorestframeworkDjangodjango-cors-headersnumpyjsonschema数据库migratepip install djangopython3 manage.py migratepip install djangorestframeworkpip install corshe...
新春代码
代码一<!--春节代码--> <div class='meiha '></div> <div class='meiha1 '></div> <style> .meiha { position: fixed; top: 0; right: 0; z-index: 999; w...
hustoj开端口
## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www....
126天前0
你可以使用以下脚本来批量创建用户,并设置统一的初始密码 `123456`。这个脚本会从 `users.txt` 文件中读取用户名列表,并为每个用户创建账户。 ### 脚本内容: ```bash #!/bin/bash # 定义初始密码 PASSWORD="123456" # 检查 users.txt 文件是否存在 if [ ! -f "users.txt" ]; then echo "Error: users.txt file not found." exit 1 fi # 读取 users.txt 文件中的用户名并创建用户 while read -r USERNAME; do # 跳过空行 if [ -z "$USERNAME" ]; then continue fi # 创建用户 sudo adduser --gecos "" --disabled-password "$USERNAME" # 设置密码 echo "$USERNAME:$PASSWORD" | sudo chpasswd echo "User $USERNAME created with password $PASSWORD" done < "users.txt" ``` ### 使用步骤: 1. **创建 `users.txt` 文件**:在同一个目录下创建一个名为 `users.txt` 的文件,每行包含一个用户名。例如: ``` user1 user2 user3 ``` 2. **保存脚本**:将上述脚本保存为 `create_users.sh`。 3. **赋予执行权限**: ```bash chmod +x create_users.sh ``` 4. **运行脚本**: ```bash ./create_users.sh ``` ### 脚本说明: - `adduser --gecos "" --disabled-password "$USERNAME"`:创建用户时,不填写 GECOS 信息(即用户的全名、电话等),并且禁用密码登录。 - `echo "$USERNAME:$PASSWORD" | sudo chpasswd`:设置用户的初始密码。 - `users.txt` 文件中的每一行代表一个用户名,脚本会逐行读取并创建用户。 ### 注意事项: - 确保你有足够的权限来执行 `sudo` 命令。 - 如果你希望用户在首次登录时修改密码,可以在创建用户后使用 `passwd --expire $USERNAME` 命令强制用户在下次登录时更改密码。dadudu1个月前0
大佬16666666666666666666666zzb1个月前0
Could not launch VNC Serverᶻ༺ᴸ*ˣ*ᴶ༻ᴷ 1个月前0
谢谢分享月がきれい 4个月前0
xuexi2222222225个月前0
好haaohao用户19324442 6个月前0
xxxx用户82958605 10个月前0
大佬666