當前位置:首頁 » 網頁前端 » kinit命令腳本
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

kinit命令腳本

發布時間: 2022-06-03 08:47:14

① linux開機時提示輸入命令但進不去啊

你還沒有進入終端
怎麼輸入startx
login
是你要輸入用戶名
passwords輸入你的密碼
當輸入密碼時都是已暗文表示的所以你看不到輸入只要輸入正確就進入終端
然後輸入startx

② 如何通過Kerberos建立兩台伺服器之間的信任(已解決)

KINIT="/usr/kerberos/bin/kinit"${KINIT} -kt /home/chaoyu.zhu/krb5.keytab——————————————————————————————scp [command]這樣是可行的,但前提是獲得krb5.keytab先——————————————————————————————keywords: ssh crontab kerberos場景:我們經常要在伺服器上定時的執行一些腳本,而這些腳本又需要訪問另外一些伺服器 問題: 我們的伺服器採用的是kerberos認證,那麼定時執行的腳本如何獲取授權並成功訪問另外一台伺服器 解決辦法:利用keytab來授權 讓我們來假定一個場景:我們有A和B兩台伺服器,我們的需求是在A伺服器上每天定時去在B伺服器上執行echo "hello"命令 第一步:准備A上的腳本,在腳本開頭加上如下的代碼export PATH="/usr/kerberos/bin:$PATH" #kerberos 安裝目錄 export KRB5CCNAME=/tmp/krb5cc_pub_$$ #產生的pubkey存放的目錄 trap kdestroy 0 1 2 3 5 15 #命令結束後刪除pubkey kinit -k -t /etc/krb5.keytab 第二步:B伺服器授權A伺服器的訪問許可權 在B伺服器上的.k5login文件中添加 host/[email protected] 其中testhost為A的伺服器名,在.k5login的配置文件中伺服器名必須小寫!!! 補充: 由於有些機器是web賬號,可能連讀取/etc/krb5.keytab許可權都沒有,導致使用keytab認證失敗,這時可以變化 一下,來進行keytab認證,步驟如下: (1)找一台keytab認證沒有問題的機器,將其/etc/krb5.keytab拷到你的目標機器上(如/data/web目錄下面) 用klist -k /data/web/krb5.keytab看一下文件內容.比如 Keytab name: FILE:/data/web/krb5.keytab KVNO Principal 3 host/[email protected] 3 host/[email protected] 3 host/[email protected] 3 host/[email protected] 由於37-52的keytab認證是ok的,所以接下來將採用37-52的principal進行keytab認證 (2)採用拷貝過來keytab進行認證

③ 需要安裝什麼使用hbase shell客戶端工具

進入hbase shell console
$HBASE_HOME/bin/hbase shell
如果有kerberos認證,需要事先使用相應的keytab進行一下認證(使用kinit命令),認證成功之後再使用hbase shell進入可以使用whoami命令可查看當前用戶

hbase(main)> whoami

表的管理
1)查看有哪些表

hbase(main)> list

2)創建表

# 語法:create <table>, {NAME => <family>, VERSIONS => <VERSIONS>}
# 例如:創建表t1,有兩個family name:f1,f2,且版本數均為2
hbase(main)> create 't1',{NAME => 'f1', VERSIONS => 2},{NAME => 'f2', VERSIONS => 2}

3)刪除表
分兩步:首先disable,然後drop
例如:刪除表t1

hbase(main)> disable 't1'
hbase(main)> drop 't1'

4)查看錶的結構

# 語法:describe <table>
# 例如:查看錶t1的結構
hbase(main)> describe 't1'

5)修改表結構
修改表結構必須先disable

# 語法:alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
# 例如:修改表test1的cf的TTL為180天
hbase(main)> disable 'test1'
hbase(main)> alter 'test1',{NAME=>'body',TTL=>'15552000'},{NAME=>'meta', TTL=>'15552000'}
hbase(main)> enable 'test1'

許可權管理
1)分配許可權

# 語法 : grant <user> <permissions> <table> <column family> <column qualifier> 參數後面用逗號分隔
# 許可權用五個字母表示: "RWXCA".
# READ('R'), WRITE('W'), EXEC('X'), CREATE('C'), ADMIN('A')
# 例如,給用戶『test'分配對表t1有讀寫的許可權,
hbase(main)> grant 'test','RW','t1'

2)查看許可權

# 語法:user_permission <table>
# 例如,查看錶t1的許可權列表
hbase(main)> user_permission 't1'

3)收回許可權

# 與分配許可權類似,語法:revoke <user> <table> <column family> <column qualifier>
# 例如,收回test用戶在表t1上的許可權
hbase(main)> revoke 'test','t1'

表數據的增刪改查
1)添加數據

# 語法:put <table>,<rowkey>,<family:column>,<value>,<timestamp>
# 例如:給表t1的添加一行記錄:rowkey是rowkey001,family name:f1,column name:col1,value:value01,timestamp:系統默認
hbase(main)> put 't1','rowkey001','f1:col1','value01'
用法比較單一。

2)查詢數據
a)查詢某行記錄

# 語法:get <table>,<rowkey>,[<family:column>,....]
# 例如:查詢表t1,rowkey001中的f1下的col1的值
hbase(main)> get 't1','rowkey001', 'f1:col1'
# 或者:
hbase(main)> get 't1','rowkey001', {COLUMN=>'f1:col1'}
# 查詢表t1,rowke002中的f1下的所有列值
hbase(main)> get 't1','rowkey001'

b)掃描表

# 語法:scan <table>, {COLUMNS => [ <family:column>,.... ], LIMIT => num}
# 另外,還可以添加STARTROW、TIMERANGE和FITLER等高級功能
# 例如:掃描表t1的前5條數據
hbase(main)> scan 't1',{LIMIT=>5}

c)查詢表中的數據行數

# 語法:count <table>, {INTERVAL => intervalNum, CACHE => cacheNum}
# INTERVAL設置多少行顯示一次及對應的rowkey,默認1000;CACHE每次去取的緩存區大小,默認是10,調整該參數可提高查詢速度
# 例如,查詢表t1中的行數,每100條顯示一次,緩存區為500
hbase(main)> count 't1', {INTERVAL => 100, CACHE => 500}

3)刪除數據
a )刪除行中的某個列值

# 語法:delete <table>, <rowkey>, <family:column> , <timestamp>,必須指定列名
# 例如:刪除表t1,rowkey001中的f1:col1的數據
hbase(main)> delete 't1','rowkey001','f1:col1'

註:將刪除改行f1:col1列所有版本的數據
b )刪除行

# 語法:deleteall <table>, <rowkey>, <family:column> , <timestamp>,可以不指定列名,刪除整行數據
# 例如:刪除表t1,rowk001的數據
hbase(main)> deleteall 't1','rowkey001'

c)刪除表中的所有數據

# 語法: truncate <table>
# 其具體過程是:disable table -> drop table -> create table
# 例如:刪除表t1的所有數據
hbase(main)> truncate 't1'

Region管理
1)移動region

# 語法:move 'encodeRegionName', 'ServerName'
# encodeRegionName指的regioName後面的編碼,ServerName指的是master-status的Region Servers列表
# 示例
hbase(main)>move '', 'db-41.xxx.xxx.org,60020,1390274516739'

2)開啟/關閉region

# 語法:balance_switch true|false
hbase(main)> balance_switch

3)手動split

# 語法:split 'regionName', 'splitKey'

4)手動觸發major compaction

#語法:
#Compact all regions in a table:
#hbase> major_compact 't1'
#Compact an entire region:
#hbase> major_compact 'r1'
#Compact a single column family within a region:
#hbase> major_compact 'r1', 'c1'
#Compact a single column family within a table:
#hbase> major_compact 't1', 'c1'

配置管理及節點重啟
1)修改hdfs配置
hdfs配置位置:/etc/hadoop/conf

# 同步hdfs配置
cat /home/hadoop/slaves|xargs -i -t scp /etc/hadoop/conf/hdfs-site.xml hadoop@{}:/etc/hadoop/conf/hdfs-site.xml
#關閉:
cat /home/hadoop/slaves|xargs -i -t ssh hadoop@{} "sudo /home/hadoop/cdh4/hadoop-2.0.0-cdh4.2.1/sbin/hadoop-daemon.sh --config /etc/hadoop/conf stop datanode"
#啟動:
cat /home/hadoop/slaves|xargs -i -t ssh hadoop@{} "sudo /home/hadoop/cdh4/hadoop-2.0.0-cdh4.2.1/sbin/hadoop-daemon.sh --config /etc/hadoop/conf start datanode"

2)修改hbase配置
hbase配置位置:

# 同步hbase配置
cat /home/hadoop/hbase/conf/regionservers|xargs -i -t scp /home/hadoop/hbase/conf/hbase-site.xml hadoop@{}:/home/hadoop/hbase/conf/hbase-site.xml

# graceful重啟
cd ~/hbase
bin/graceful_stop.sh --restart --reload --debug inspurXXX.xxx.xxx.org

④ 怎樣利用samba讓linux訪問windows

Samba伺服器是Linux系統上安裝的文件共享服務。本身問題描述就存在誤區。


如果是在Linux上訪問Windows共享文件,只需要使用smbclient命令,通過smb協議訪問Windows共享文件即可,如下圖所示:

⑤ hbase 命令一次可以寫入多個值嗎

進入hbase
shell
console$HBASE_HOME/bin/hbase
shell如果有kerberos認證,需要事先使用相應的keytab進行一下認證(使用kinit命令),認證成功之後再使用hbase
shell進入可以使用whoami命令可查看當前用戶

⑥ linux 怎樣把密碼輸入kinit admin

1.配置DNS

# vi /etc/resolv.conf

nameserver 192.168.2.30

nameserver 192.168.2.32

# vi /etc/host.conf

# nslookup 192.168.2.32 DNS查找

# net time SET 192.168.2.32 時間同步,客戶端以伺服器時間為准

2.samba

首先確保Linux系統中安裝了samba包,並用下述命令來檢查samba包的基礎庫支持,一般的RPM安裝都不會有問題。

# smbd -b | grep LDAP

HAVE_LDAP_H

HAVE_LDAP

HAVE_LDAP_DOMAIN2HOSTLIST

...

# smbd -b | grep KRB

HAVE_KRB5_H

HAVE_ADDRTYPE_IN_KRB5_ADDRESS

HAVE_KRB5

...

# smbd -b | grep ADS

WITH_ADS

WITH_ADS

# smbd -b | grep WINBIND

WITH_WINBIND

WITH_WINBIND

3.krb5配置

配置編輯/etc/krb5.conf,配置完成後,執行

# kinit [email protected]

4.Samba配置

編輯配置/etc/samba/smb.conf後,重啟samba服務

# service samba restart

# net ads join -U [email protected] 加入域,這時需要輸入域管理員密碼

5.winbind配置

編輯/etc/nsswitch.conf,更改passwd和group為(files需視你linux系統配置NIS與否,如配置NIS,則為compat)

passwd: files winbind

group: files winbind

保存後(重)啟動samba服務。(重)啟動winbind。

用 wbinfo -u檢索用戶,wbinfo -g檢索用戶組來測試winbind是否正常。

1.配置DNS

# vi /etc/resolv.conf

nameserver 192.168.2.30

nameserver 192.168.2.32

# vi /etc/host.conf

# nslookup 192.168.2.32 DNS查找

# net time SET 192.168.2.32 時間同步,客戶端以伺服器時間為准

2.samba

首先確保Linux系統中安裝了samba包,並用下述命令來檢查samba包的基礎庫支持,一般的RPM安裝都不會有問題。

# smbd -b | grep LDAP

HAVE_LDAP_H

HAVE_LDAP

HAVE_LDAP_DOMAIN2HOSTLIST

...

# smbd -b | grep KRB

HAVE_KRB5_H

HAVE_ADDRTYPE_IN_KRB5_ADDRESS

HAVE_KRB5

...

# smbd -b | grep ADS

WITH_ADS

WITH_ADS

# smbd -b | grep WINBIND

WITH_WINBIND

WITH_WINBIND

3.krb5配置

配置編輯/etc/krb5.conf,配置完成後,執行

# kinit [email protected]

4.Samba配置

編輯配置/etc/samba/smb.conf後,重啟samba服務

# service samba restart

# net ads join -U [email protected] 加入域,這時需要輸入域管理員密碼

5.winbind配置

編輯/etc/nsswitch.conf,更改passwd和group為(files需視你linux系統配置NIS與否,如配置NIS,則為compat)

passwd: files winbind

group: files winbind

保存後(重)啟動samba服務。(重)啟動winbind。

用 wbinfo -u檢索用戶,wbinfo -g檢索用戶組來測試winbind是否正常

⑦ 如何設置samba加入ADS

1.samba伺服器軟體需求

CODE:
krb5-workstation-1.2.7-19
pam_krb5-1.70-1
krb5-devel-1.2.7-19
krb5-libs-1.2.7-19
samba-3.0.5-2

2.配置kerberos(關鍵)
下面配置參數讓 Kerberos 進程知道處理活動目錄伺服器,對 /etc/krb5.conf 做適當的修改,修改時需要注意的是 Kerberos 是大小寫敏感的。
這是我的krb5.conf配置文件:

CODE:
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log

[libdefaults]
ticket_lifetime = 24000
default_realm = MYDOMAIN.COM
dns_lookup_realm = false
dns_lookup_kdc = false

[realms]
MYDOMAIN.COM = {
kdc = 192.168.2.248
# admin_server = kerberos.example.com:749
default_domain = MYDOMAIN.COM
}

[domain_realm]
.mydomain.com = MYDOMAIN.COM
mydomain.com = MYDOMAIN.COM

[kdc]
profile = /var/kerberos/krb5kdc/kdc.conf

[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}

3.連接2003伺服器

kinit [email protected]

Kerberos 的 kinit 命令將測試伺服器間的通信,後面的域名MYDOMAIN.COM 是你的活動目錄的域名,必須大寫,否則會收到錯誤信息:

CODE:
kinit(v5): Cannot find KDC for requested realm while getting initial credentials.

如果通信正常,你會提示輸入口令,口令正確的話,就返回 bash 提示符,如果錯誤則報告:

CODE:
kinit(v5): Preauthentication failed while getting initial credentials.

4.配置samba
修改/etc/samba/smb.conf如下幾行

CODE:
workgroup = MYDOMAIN
netbios name = filesrv
server string = Filesrv

realm = MYDOMAIN.COM // 活動目錄伺服器域名
security = ADS // 採用活動目錄認證方式
encrypt passwords = yes // 採用加密的口令

重新啟動samba服務

CODE:
service smb restart

配置完 Samba 和 Kerberos 後,需要在 Windows 2000 活動目錄下建立一個計算機帳號,如果需要在 Linux 上來完成的話,運行:

CODE:
/usr/kerberos/bin/kinit [email protected]

輸入口令後,建立帳號:

將伺服器加入活動目錄:

CODE:
/usr/local/samba/bin/net ads join

去 Windows 2003 伺服器檢查上面的工作:打開活動目錄用戶和計算機,查看其中的條目,如果成功的話,就可以看到你的 Linux 伺服器。

然後在 Linux 機器上,你就可以採用 smbclient 命令連接到 Windows 的共享文件夾,而不需要輸入口令(因為採用了Kerberos )。

CODE:
/usr/local/samba/bin/smbclient //w2k/c$ -k

這個命令可能會產生一些錯誤信息,但是不要緊它能工作的。

⑧ Java有沒有這樣的命令行參數工具

Java 命令行工具總結

C/Documents and Settings/Zianed>ls 『%JAVA_HOME%』/bin

HtmlConverter.exe javap.exe jstatd.exe rmid.exe

appletviewer.exe javaw.exe jvisualvm.exe rmiregistry.exe

apt.exe javaws.exe keytool.exe schemagen.exe

beanreg.dll jconsole.exe kinit.exe serialver.exe

extcheck.exe jdb.exe klist.exe servertool.exe

idlj.exe jhat.exe ktab.exe tnameserv.exe

jar.exe jinfo.exe msvcr71.dll unpack200.exe

jarsigner.exe jli.dll native2ascii.exe wsgen.exe

java-rmi.exe jmap.exe orbd.exe wsimport.exe

java.exe jps.exe pack200.exe xjc.exe

javac.exe jrunscript.exe packager.exe

javadoc.exe jstack.exe policytool.exe

javah.exe jstat.exe rmic.exe

需要獲得其中的幫助使用XX -help即可

Basic Tools

These tools are the foundation of the JDK. They are the tools you use to create and build applications.

Tool Name Brief Description Links to Reference Pages

javac The compiler for the Java programming language. [Solaris and Linux ] [Windows ]

java The launcher for Java applications. In this release, a single launcher is used both for development and deployment.

The old deployment launcher, jre , is no longer provided. [Solaris and Linux ] [Windows ]

javadoc API documentation generator.

See Javadoc Tool page for doclet and taglet APIs. [Solaris and Linux ] [Windows ]

apt Annotation processing tool.

See Annotation Processing Tool for program annotation processing. [Solaris, Linux, and Windows ]

appletviewer Run and debug applets without a web browser. [Solaris and Linux ] [Windows ]

jar Create and manage Java Archive (JAR) files.

See Java Archive Files page for the JAR specification. [Solaris and Linux ] [Windows ]

jdb The Java Debugger.

See JPDA for the debugger architecture specifications. [Solaris and Linux ] [Windows ]

javah C header and stub generator. Used to write native methods. [Solaris and Linux ] [Windows ]

javap Class file disassembler [Solaris and Linux ] [Windows ]

extcheck Utility to detect Jar conflicts. [Solaris and Linux ] [Windows ]

--------------------------------------------------------------------------------

Security Tools

These security tools help you set security policies on your system and create apps that can work within the scope of security policies set at remote sites.

Tool Name Brief Description Links to Reference Pages

keytool Manage keystores and certificates. [Solaris and Linux ] [Windows ]

jarsigner Generate and verify JAR signatures. [Solaris and Linux ] [Windows ]

policytool GUI tool for managing policy files. [Solaris and Linux ] [Windows ]

These security tools help you obtain, list, and manage Kerberos tickets.

Tool Name Brief Description Links to Reference Pages

kinit Tool for obtaining Kerberos v5 tickets. Equivalent functionality is available on the Solaris operating environment via the kinit tool. For example, for Solaris 8, see the kinit reference page . [Linux ] [Windows ]

klist Command-line tool to list entries in credential cache and key tab. Equivalent functionality is available on the Solaris operating environment via the klist tool. For example, for Solaris 8, see the klist reference page . [Linux ] [Windows ]

ktab Command-line tool to help the user manage entires in the key table. Equivalent functionality is available on the Solaris operating environment via the kadmin tool. For example, for Solaris 8, see the kadmin reference page . [Linux ] [Windows ]

--------------------------------------------------------------------------------

Internationalization Tools

This tool helps to create localizable apps.

Tool Name Brief Description Links to Reference Pages

native2ascii Convert text to Unicode Latin-1. [Solaris and Linux ] [Windows ]

--------------------------------------------------------------------------------

Remote Method Invocation (RMI) Tools

These tools help to create apps that interact over the Web or other network.

Tool Name Brief Description Links to Reference Pages

rmic Generate stubs and skeletons for remote objects. [Solaris and Linux ] [Windows ]

rmiregistry Remote object registry service. [Solaris and Linux ] [Windows ]

rmid RMI activation system daemon. [Solaris and Linux ] [Windows ]

serialver Return class serialVersionUID. [Solaris and Linux ] [Windows ]

--------------------------------------------------------------------------------

Java IDL and RMI-IIOP Tools

These tools are used when creating applications that use OMG-standard IDL and CORBA/IIOP.

Tool Name Brief Description

tnameserv Provides access to the naming service.

idlj Generates .java files that map an OMG IDL interface and enable an application written in the Java programming language to use CORBA functionality.

orbd Provides support for clients to transparently locate and invoke persistent objects on servers in the CORBA environment. ORBD is used instead of the Transient Naming Service, tnameserv. ORBD includes both a Transient Naming Service and a Persistent Naming Service. The orbd tool incorporates the functionality of a Server Manager, an Interoperable Naming Service, and a Bootstrap Name Server. When used in conjunction with the servertool, the Server Manager locates, registers, and activates a server when a client wants to access the server.

servertool Provides ease-of-use interface for the application programmers to register, unregister, startup, and shutdown a server.

--------------------------------------------------------------------------------

Java Deployment Tools

Utilities for use in conjunction with deployment of java applications and applets on the web.

Tool Name Brief Description

pack200 Transforms a JAR file into a compressed pack200 file using the Java gzip compressor. The compressed packed files are highly compressed JARs, which can be directly deployed, saving bandwidth and recing download time.

unpack200 Transforms a packed file proced by pack200 into a JAR file.

--------------------------------------------------------------------------------

Java Plug-in Tools

Utilities for use in conjunction with the Java Plug-in.

Tool Name Brief Description with Links to Reference Pages

htmlconverter Converts an HTML page (file) containing applets to the OBJECT / EMBED tag format for Java Plug-in.

--------------------------------------------------------------------------------