Uncategorized

centos add epel source 添加源

http://blog.csdn.net/yasi_xi/article/details/11746255

三,安装epel,centos6选6,5就选5
32位系统选择:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

64位系统选择:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

导入key:
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

如果用比较新的软件,用epel-test.repo这个文件就行了
别忘了安装yum install yum-priorities

标准
Uncategorized

firewall-cmd 新防火墙 CentOS 7

http://docs.diladele.com/tutorials/transparently_filtering_https_centos/firewall.html

[root@localhost firewalld]# pwd
/etc/firewalld
[root@localhost firewalld]# cat direct.xml

    -i eno33554992 -p tcp –dport 80 -j REDIRECT –to-ports 3126
    -i eno33554992 -p tcp –dport 443 -j REDIRECT –to-ports 3127

[root@localhost firewalld]#

标准
Uncategorized

linux change user name uid group name

https://wiki.archlinux.org/index.php/change_username

http://www.cyberciti.biz/faq/howto-change-rename-user-name-id/

usermod -l login-name old-name

usermod -u UID username

usermod -c “New Real Name” username

Link A User’s former $HOME to new $HOME

This will created a link between username’s former home directory to the new one. Doing this will allow programs to find files that have hardcoded paths.
Warning: Make sure there is no trailing / on /my/old/home

# ln -s /my/new/home/ /my/old/home

Change Group Name

If you want to change the user’s group also:

# groupmod -n newname oldname

Note: This will change a group name but not the numerical GID of the group.

For further information see the man pages for usermod and groupmod.

标准
Uncategorized

batch change password username home path 批量修改密码 用户名 和家目录

for /f “tokens=1,2,3” %%i in (pwwin.txt) do (
if “%%j”==”administrator” psexec \\%%i net user administrator %%k
if “%%j”==”ubuntu” echo yes | plink -agent -l ubuntu -pw oldpass %%i echo -e ‘oldpass\n%%k\n%%k’ ^| passwd
)

echo ‘user:pass’ | chpasswd

echo -e ‘oldpass\nnewpass\nnewpass’ | passwd

echo -e ‘password\npassword’ | passwd –stdin user

for /f “tokens=1,2,3,4” %%i in (pwlin.txt) do (
echo yes | plink.exe -agent -ssh -l ubuntubj -pw pass %%j echo echo ‘root:pass’ \^| chpasswd ^> modroot.sh
echo yes | plink.exe -agent -ssh -l ubuntubj -pw pass %%j echo -e ‘pass\n’ ^| sudo -S bash ./modroot.sh
)

for /f “tokens=1,2,3,4” %%i in (pwlin.txt) do (
echo yes | plink.exe -agent -ssh -l root -pw pass %%j  usermod -l newusername oldusername
echo yes | plink.exe -agent -ssh -l root -pw pass %%j usermod -c newusername newusername
echo yes | plink.exe -agent -ssh -l root -pw pass %%j usermod -m -d /home/newusername newusername
echo yes | plink.exe -agent -ssh -l root -pw pass %%j groupmod -n newusername oldusername
)

for /f “tokens=1,2,3,4” %%i in (pwlin.txt) do (
echo yes | plink.exe -agent -ssh -l root -pw pass %%j  usermod -p ‘!’ root
)

标准