A few small scripts

Source: Internet
Author: User

1, Batch build 20 accounts, from USER1,USER2,USER20; password is user followed by five-bit random characters

[email protected] shell]# cat Guseradd
#!/bin/bash
For i in {1..20}; Do
x= "User"
pass= $x $ (tr-dc \~\ ' \[email protected]#\$\%\^\&\*\ (\) \-\_\+\=\|\\\?\/\.\>\,\<a-za-z0-9_ </dev/urandom |head-c 5|xargs) ##/dev/urandom generate random number #
Useradd User${i}
echo $pass | passwd user${i}--stdin # #stdin表示从标准输入读取令牌 # #
echo "User${i} <=============> $pass" >>./userlist.log
Done
Echo ' sucess,passwd is in Userlist.log '

2, Bulk Delete User1,user2...user20 these 20 accounts

#cat Guserdel
#!/bin/bash
For i in {1..20}; Do
Userdel-r User${i}
echo "User${i} is del" |tee-a Userdel.log
Done
echo "Sucess,users is deleted"


3, Mount \\10.10.1.1\SD shared folder, assuming that the account is User1, password is P4ssword,

Mkdir-p/MNT/SD

Mount-t CIFS//10.10.1.1/sd/mnt/sd-o User=user1,password=p4ssword

This article is from the "Wind Up! billows!" blog, be sure to keep this source http://superzxh.blog.51cto.com/27819/1675194

A few small scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.