顯示具有 solaris 標籤的文章。 顯示所有文章
顯示具有 solaris 標籤的文章。 顯示所有文章

2008年10月23日 星期四

unix 修改密碼偷吃步

expect
配合 console 作變化

自已作一個文檔
要改的時候就用貼的

#/.updat_root_passwd.exp Host user userpwd rootpwd newpwd
/script/updat_root_passwd.exp 192.168.1.1 c9992 pwd GOD dog
/script/updat_root_passwd.exp 192.168.1.2 c9992 pwd GOD dog




#!/usr/local/bin/expect
#scriptname : updat_root_passwd.exp
set HOSTNAME [lindex $argv 0]
set USERNAME [lindex $argv 1]
set USERPASSWD [lindex $argv 2]
set ROOTPASSWD [lindex $argv 3]
set NEWROOTPASSWD [lindex $argv 4]

spawn ssh $USERNAME@$HOSTNAME

expect "*assword:*"
send "$USERPASSWD\r"

expect "*>*"
send "su \r"

expect "*assword:*"
send "$ROOTPASSWD\r"

expect "*#*"
send "passwd root\r"

expect "*assword:*"
send "$NEWROOTPASSWD\r"

expect "*assword:*"
send "$NEWROOTPASSWD\r"

expect "*passwd: password successfully changed for root*"
exit

2007年12月15日 星期六

solaris 上網相關

solaris 上網相關


1. /etc/hosts or /etc/inet/hosts hosts file
2. /etc/resolv.conf DNS 解析
3. /etc/nsswitch.conf 名稱conf檔
4. /etc/defaultrouter defaultroute


1 hosts 檔案

bash-2.05# cat /etc/hosts
#
# Internet host table
#
# ip hostname
127.0.0.1 localhost
10.10.10.240 testVM
10.10.10.10 router

2 resolv.conf

bash-2.05# cat /etc/resolv.conf
#DNS 解析
nameserver 168.95.1.1
nameserver 10.10.10.10

3 /etc/nsswitch.conf

bash-2.05# grep hosts /etc/nsswitch.conf
# "hosts:" and "services:" in this file are used only if the
hosts: files dns


4 /etc/defaultrouter

default gateway

bash-2.05# cat /etc/defaultrouter
10.10.10.10




cat /etc/hosts
cat /etc/resolv.conf
grep hosts /etc/nsswitch.conf
cat /etc/defaultrouter

RHEL install EPEL

  https://www.linuxtechi.com/install-epel-repo-on-rhel-system/ EPEL dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest...