linux涓嬫枃浠跺姞瀵嗘柟娉曟€荤粨
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux涓嬫枃浠跺姞瀵嗘柟娉曟€荤粨相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/process' title='process'>process
director license 澧炲姞 甯姪鍛戒护 鏈湴 鎯呭喌 zip 浣跨敤鏂规硶涓轰簡瀹夊叏鑰冭檻锛岄€氬父浼氬涓€浜涢噸瑕佹枃浠惰繘琛屽姞瀵嗗浠芥垨鍔犲瘑淇濆瓨锛屼笅闈㈠linux涓嬬殑鏂囦欢鍔犲瘑鏂规硶鍋氫竴绠€鍗曟€荤粨锛?/p>
鏂规硶涓€锛歡zexe鍔犲瘑
杩欑鍔犲瘑鏂瑰紡涓嶆槸闈炲父淇濋櫓鐨勬柟娉曪紝浣嗘槸鑳藉婊¤冻涓€鑸殑鍔犲瘑鐢ㄩ€旓紝鍙互闅愯斀鑴氭湰涓殑瀵嗙爜绛変俊鎭€?br />瀹冩槸浣跨敤绯荤粺鑷甫鐨刧zexe绋嬪簭锛屽畠涓嶄絾鍔犲瘑锛屽悓鏃跺帇缂╂枃浠躲€?strong>绀轰緥濡備笅锛?/span>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
[root@ipsan-node03 ~] # echo "hahahaha" > a.txt [root@ipsan-node03 ~] # cat a.txt hahahaha [root@ipsan-node03 ~] # ls a.txt a.txt [root@ipsan-node03 ~] # gzexe a.txt a.txt: 22.2% [root@ipsan-node03 ~] # ls a.txt a.txt~ gzexe鏂规硶浼氭妸鍘熸潵娌℃湁鍔犲瘑鐨勬枃浠禷.txt澶囦唤涓篴.txt~ ,鍚屾椂a.txt鏂囦欢鍙樻垚浜嗗姞瀵嗘枃浠讹紙鍗冲彉鎴愪簡瀵嗘枃锛?/code> [root@ipsan-node03 ~] # cat a.txt ???铻??p¹ v £??y«0 Fc???ÿE??0´ûm ?:n$9hss4¢03 NeAE?VºY¯??¾¹«*闇?shy;+]?aΜ Y$@:Wj% .i?¬Z®:J ¦b¶mC<?8n [root@ipsan-node03 ~] # cat a.txt~ hahahaha 閫氬父浣跨敤gzexe鍔犲瘑鍚庯紝浼氬皢澶囦唤鏂囦欢锛堣繖閲屾寚a.txt~锛夊垹闄?/code> [root@ipsan-node03 ~] # ls a.txt a.txt~ [root@ipsan-node03 ~] # rm -f a.txt~ [root@ipsan-node03 ~] # ls a.txt 浣跨敤-d鍙傛暟杩涜瑙e帇鎿嶄綔 [root@ipsan-node03 ~] # gzexe --help Usage: /usr/bin/gzexe [OPTION] FILE... Rename each FILE with a compressed version of itself, renaming FILE to FILE~. -d Decompress each FILE instead of compressing it. --help display this help and exit --version output version information and exit Report bugs to <bug- gzip @gnu.org>. 瑙e帇涔嬪悗鐨勬枃浠禷.txt鍐呭灏变細杩樺師鍥炴潵锛屽悓鏃朵篃浼氬皢涔嬪墠鐨勫姞瀵嗘枃浠跺彉鎴恆.txt~锛屽悓鏍凤紝閫氬父涔熶細鍒犻櫎杩欎釜a.txt~鐨勫浠芥枃浠?/code> [root@ipsan-node03 ~] # gzexe -d a.txt [root@ipsan-node03 ~] # ls a.txt a.txt~ [root@ipsan-node03 ~] # cat a.txt hahahaha [root@ipsan-node03 ~] # cat a.txt~ ???铻??p¹ v £??y«0 Fc???ÿE??0´ûm ?:n$9hss4¢03 NeAE?VºY¯??¾¹«*闇?shy;+]?aΜ Y$@:Wj% .i?¬Z®:J ¦b¶mC<?8n [root@ipsan-node03 ~] # rm -f a.txt~ [root@ipsan-node03 ~] # ls a.txt |
鏂规硶浜岋細鐢╰ar鍛戒护 瀵规枃浠跺姞瀵嗗帇缂╁拰瑙e帇
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
[root@ipsan-node03 ~] # ls test .txt [root@ipsan-node03 ~] # cat test.txt hahahaha heiheihei 濡備笅鍛戒护鏄filename鏂囦欢锛?/code> [root@ipsan-node03 ~] # tar -zcf - test.txt |openssl des3 -salt -k 123@123 | dd of=test.txt.des3 0+1 records in 0+1 records out 152 bytes (152 B) copied, 0.00333366 s, 45.6 kB /s --------------------------------------------------------------------------------------------------------- 涔熷彲浠ュ皢 /mnt 鐩綍涓嬬殑鎵€鏈夋枃浠跺叏閮ㄥ姞瀵嗗帇缂?/code> [root@ipsan-node03 ~] # tar -zcf - /mnt/* |openssl des3 -salt -k 123@123 | dd of=test.des3 鎴栬€呮牴鎹尮閰嶈鍒欒繘琛屽姞瀵嗗帇缂?/code> [root@ipsan-node03 ~] # tar -zcf - /mnt/pass_* |openssl des3 -salt -k 123@123 | dd of=test.des3 --------------------------------------------------------------------------------------------------------- 閫氬父鍔犲瘑鍚庯紝浼氬皢婧愭枃浠跺垹闄?/code> [root@ipsan-node03 ~] # ls test .txt test .txt.des3 [root@ipsan-node03 ~] # rm -f test.txt [root@ipsan-node03 ~] # cat test.txt.des3 Salted__H¡+ZCHaW?? S©|>þH?*???³??@?????qk)B?¡qk;ochlcz-??/? ¤??+¾´2AuK????t鎮恆h¤º???d 瑙e帇鎿嶄綔锛?/code> [root@ipsan-node03 ~] # dd if=test.txt.des3 |openssl des3 -d -k 123@123 | tar zxf - 0+1 records in 0+1 records out 152 bytes (152 B) copied, 4.5873e-05 s, 3.3 MB /s [root@ipsan-node03 ~] # ls test .txt test .txt.des3 [root@ipsan-node03 ~] # cat test.txt hahahaha heiheihei 娉ㄦ剰鍛戒护鏈€鍚庨潰鐨?/code> -k 123@123鍙互娌℃湁锛屾病鏈夋椂鍦ㄨВ鍘嬫椂浼氭彁绀鸿緭鍏ュ瘑鐮?/code> |
鏂规硶涓夛細缁撳悎Tar鍜孫penSSL缁欐枃浠跺拰鐩綍鍔犲瘑鍙婅В瀵?/span>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
褰撴湁閲嶈鐨勬晱鎰熸暟鎹殑鏃跺€欙紝缁欐枃浠跺拰鐩綍棰濆鍔犱竴灞備繚鎶ゆ槸鑷冲叧閲嶈鐨勶紝鐗瑰埆鏄綋闇€瑕侀€氳繃缃戠粶涓庝粬浜轰紶杈撴暟鎹殑鏃跺€欍€傚熀浜庤繖涓師鍥狅紝 鍙互鐢ㄥ埌 tar 锛圠inux 鐨勪竴涓帇缂╂墦鍖呭伐鍏凤級鍜孫penSSL鏉ヨВ鍐崇殑鏂规銆傚€熷姪杩欎袱涓伐鍏凤紝浣犵湡鐨勫彲浠ユ涓嶈垂鍔涘湴鍒涘缓鍜屽姞瀵? tar 褰掓。鏂囦欢銆?/code> 涓嬮潰浠嬬粛浣跨敤 OpenSSL鍒涘缓鍜屽姞瀵? tar 鎴?gz锛?/code> 鐗㈣浣跨敤 OpenSSL 鐨勫父瑙勬柟寮忔槸锛?/code> # openssl command command-options arguments 绀轰緥濡備笅锛?/code> [root@ipsan-node03 ~] # cd /mnt/ [root@ipsan-node03 mnt] # ls [root@ipsan-node03 mnt] # echo "123" > a.txt [root@ipsan-node03 mnt] # echo "456" > b.txt [root@ipsan-node03 mnt] # echo "789" > c.txt [root@ipsan-node03 mnt] # ls a.txt b.txt c.txt 鐜板湪瑕佸姞瀵嗗綋鍓嶅伐浣滅洰褰曠殑鍐呭锛堟牴鎹枃浠剁殑澶у皬锛岃繖鍙兘闇€瑕佷竴鐐规椂闂达級 [root@ipsan-node03 mnt] # tar -czf - * | openssl enc -e -aes256 -out test.tar.gz enter aes-256-cbc encryption password: // 鍋囪杩欓噷璁剧疆鐨勫瘑鐮佷负123456 Verifying - enter aes-256-cbc encryption password: 涓婅堪鍛戒护鐨勮В閲婏細 enc 浣跨敤鍔犲瘑杩涜缂栫爜 -e 鐢ㄦ潵鍔犲瘑杈撳叆鏂囦欢鐨?enc 鍛戒护閫夐」锛岃繖閲屾槸鎸囧墠涓€涓? tar 鍛戒护鐨勮緭鍑?/code> -aes256 鍔犲瘑鐢ㄧ殑绠楁硶 -out 鐢ㄤ簬鎸囧畾杈撳嚭鏂囦欢鍚嶇殑 enc 鍛戒护閫夐」锛岃繖閲屾枃浠跺悕鏄?/code> [root@ipsan-node03 mnt] # ls a.txt b.txt c.txt test . tar .gz [root@ipsan-node03 mnt] # rm -rf a.txt [root@ipsan-node03 mnt] # rm -rf b.txt [root@ipsan-node03 mnt] # rm -rf c.txt [root@ipsan-node03 mnt] # ls test . tar .gz 瀵逛簬涓婇潰鍔犲瘑鍚庣殑 tar 鍖呯洿鎺ヨВ鍘嬭偗瀹氭槸涓嶈鐨勶紒 [root@ipsan-node03 mnt] # tar -zvxf test.tar.gz gzip : stdin: not in gzip format tar : Child returned status 1 tar : Error is not recoverable: exiting now 瑕佽В瀵嗕笂杩?/code> [root@ipsan-node03 mnt] # openssl enc -d -aes256 -in test.tar.gz | tar xz -C /mnt/ enter aes-256-cbc decryption password: [root@ipsan-node03 mnt] # ls a.txt b.txt c.txt test . tar .gz 涓婅堪鍛戒护鐨勮В閲婏細 -d 鐢ㄤ簬瑙e瘑鏂囦欢 -C 灏嗗姞鍘嬪悗鐨勬枃浠舵彁鍙栧埌鐩爣鐩綍涓?/code> 褰撲綘鍦ㄦ湰鍦扮綉缁滄垨鍥犵壒缃戝伐浣滅殑鏃跺€欙紝浣犲彲浠ラ殢鏃堕€氳繃鍔犲瘑鏉ヤ繚鎶や綘鍜屼粬浜哄叡浜殑閲嶈鏂囨湰鎴栨枃浠讹紝杩欐湁鍔╀簬闄嶄綆灏嗗叾鏆撮湶缁欐伓鎰忔敾鍑昏€呯殑椋庨櫓銆?/code> |
鏂规硶鍥涳細shc鍔犲瘑锛堜粎浠呭shell鑴氭湰鍔犲瘑锛?/span>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
shc鏄竴涓笓涓氱殑鍔犲瘑shell鑴氭湰鐨勫伐鍏?瀹冪殑浣滅敤鏄妸shell鑴氭湰杞崲涓轰竴涓彲鎵ц鐨勪簩杩涘埗鏂囦欢锛岃繖涓姙娉曞緢濂界殑瑙e喅浜嗚剼鏈腑鍚湁IP銆?/code> 瀵嗙爜绛変笉甯屾湜鍏紑鐨勯棶棰樸€?/code> 濡傛灉浣犵殑shell鑴氭湰鍖呭惈浜嗘晱鎰熺殑鍙d护鎴栬€呭叾瀹冮噸瑕佷俊鎭? 鑰屼笖浣犱笉甯屾湜鐢ㄦ埛閫氳繃 ps -ef(鏌ョ湅绯荤粺姣忎釜杩涚▼鐨勭姸鎬?鎹曡幏鏁忔劅淇℃伅. 浣犲彲浠?/code> 浣跨敤shc宸ュ叿鏉ョ粰shell鑴氭湰澧炲姞涓€灞傞澶栫殑瀹夊叏淇濇姢. shc鏄竴涓剼鏈紪璇戝伐鍏? 浣跨敤RC4鍔犲瘑绠楁硶, 瀹冭兘澶熸妸shell绋嬪簭杞崲鎴愪簩杩涘埗鍙墽 琛屾枃浠?鏀寔闈欐€侀摼鎺ュ拰鍔ㄦ€侀摼鎺?. 璇ュ伐鍏疯兘澶熷緢濂界殑鏀寔: 闇€瑕佸姞瀵? 瑙e瘑, 鎴栬€呴€氳繃鍛戒护鍙傛暟浼犻€掑彛浠ょ殑鐜. shc鐨勫畼缃戜笅杞藉湴鍧€: http: //www .datsi. fi .upm.es/~frosal /sources/ 瀹夎鏂规硶锛?/code> [root@ipsan-node03 ~] # cd /usr/local/src/ [root@ipsan-node03 src] # wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz [root@ipsan-node03 src] # tar -zvxf shc-3.8.9.tgz [root@ipsan-node03 src] # cd shc-3.8.9 [root@ipsan-node03 shc-3.8.9] # mkdir -p /usr/local/man/man1 杩欐鏄繀椤荤殑锛屼笉鐒跺畨瑁呰繃绋嬩腑浼氭姤閿欙紝shc灏嗗畨瑁呭懡浠ゅ埌 /usr/local/bin/ 鐩綍涓嬶紱 灏嗗府鍔╂枃妗e瓨鏀惧湪 /usr/local/man/man1/ 鐩綍涓嬶紝濡傛灉绯荤粺涓棤姝ょ洰褰曪紝瀹夎鏃朵細鎶ラ敊锛屽彲鍒涘缓姝ょ洰褰曞悗鍐嶆墽琛屽畨瑁?/code> [root@ipsan-node03 shc-3.8.9] # make install 杩欐槸瑕佸洖绛?/code> 闇€瑕佹敞鎰忕殑鏄紝sch鍙兘鑳絪hell鑴氭湰鏂囦欢杩涜鍔犲瘑锛屽叾浠栨枃浠堕兘涓嶅彲浠ワ紒 sch鍔犲瘑浣跨敤鏂规硶: "-f" 閫夐」鎸囧畾闇€瑕佸姞瀵嗙殑绋嬪簭 [root@ipsan-node03 ~] # ls text.sh [root@ipsan-node03 ~] # cat text.sh #!/bin/bash echo "hahaha" [root@ipsan-node03 ~] # shc -r -f text.sh [root@ipsan-node03 ~] # ls text.sh text.sh.x text.sh.x.c 娉ㄦ剰:瑕佹湁-r閫夐」, -f 鍚庤窡瑕佸姞瀵嗙殑鑴氭湰鍚嶃€?/code> 杩愯鍚庝細鐢熸垚涓や釜鏂囦欢,script-name.x 鍜?script-name.x.c script-name.x鏄姞瀵嗗悗鐨勫彲鎵ц鐨勪簩杩涘埗鏂囦欢. . /script-name .x 鍗冲彲杩愯. script-name.x.c鏄敓鎴恠cript-name.x鐨勫師鏂囦欢(c璇█) [root@ipsan-node03 ~] # ./text.sh hahaha [root@ipsan-node03 ~] # ./text.sh.x hahaha 閫氬父浠庡畨鍏ㄨ搴﹁€冭檻锛?/code> 浣跨敤sch鍛戒护瀵箂hell鑴氭湰鏂囦欢杩涜鍔犲瘑鍚庯紝鍙渶淇濈暀.x鐨勪簩杩涘埗鏂囦欢鍗冲彲锛屽叾浠栦袱涓枃浠跺潎鍙互鍒犻櫎锛?/code> [root@ipsan-node03 ~] # ls text.sh text.sh.x text.sh.x.c [root@ipsan-node03 ~] # rm -rf text.sh [root@ipsan-node03 ~] # rm -rf text.sh.x.c [root@ipsan-node03 ~] # ls text.sh.x [root@ipsan-node03 ~] # ./text.sh.x hahaha 鍙﹀锛?/code> shc杩樻彁渚涗簡涓€绉嶈瀹氭湁鏁堟墽琛屾湡闄愮殑鏂规硶锛屽彲浠ラ鍏堜娇鐢╯hc灏唖hell绋嬪簭杞寲涓轰簩杩涘埗锛屽苟鍔犱笂杩囨湡鏃堕棿锛屽锛?/code> [root@ipsan-node03 ~] # shc -e 28/02/2018 -m "this script file is about to expire" -v -r -f text.sh shc shll= bash shc [-i]=-c shc [-x]= exec 鈥?s鈥?/code> shc [-l]= shc opts= shc: cc text.sh.x.c -o text.sh.x shc: strip text.sh.x shc: chmod go-r text.sh.x [root@ipsan-node03 ~] # ls text.sh text.sh.x text.sh.x.c 瑙i噴锛?/code> -e:鎸囧畾杩囨湡鏃堕棿涓?018骞?鏈?8鏃?/code> -m:杩囨湡鍚庢墦鍗板嚭鐨勪俊鎭紱 - v : verbose -r: 鍙湪鐩稿悓鎿嶄綔绯荤粺鐨勪笉鍚屼富鏈轰笂鎵ц -f: 鎸囧畾婧恠hell 濡傛灉鍦ㄨ繃鏈熷悗鎵ц锛屽垯浼氭湁濡備笅鎻愮ず锛?/code> [root@ipsan-node03 ~] # ./text.sh.x . /text .sh.x: this script file is about to expire 浣跨敤浠ヤ笂鏂规硶瑕佹敞鎰忥紝闇€闃叉鐢ㄦ埛鏇存敼绯荤粺鏃堕棿锛屽彲浠ラ€氳繃鍦ㄧ▼搴忎腑鍔犲叆鑷姩鏇存柊绯荤粺鏃堕棿鐨勫懡浠ゆ潵瑙e喅姝ら棶棰橈紒锛?/code> sch鐨勫府鍔╁懡浠わ細 [root@ipsan-node03 ~] # shc -help shc Version 3.8.9, Generic Script Compiler shc Copyright (c) 1994-2012 Francisco Rosales <frosal@ fi .upm.es> shc Usage: shc [-e date ] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script -e %s Expiration date in dd /mm/yyyy format [none] 锛堟寚瀹氳繃鏈熸棩鏈燂級 -m %s Message to display upon expiration [ "Please contact your provider" ] 锛堟寚瀹氳繃鏈熸彁绀虹殑淇℃伅锛?/code> -f %s File name of the script to compile 锛堟寚瀹氳缂栬瘧鐨剆hell鐨勮矾寰勫強鏂囦欢鍚嶏級 -i %s Inline option for the shell interpreter i.e: -e -x %s eXec command , as a printf format i.e: exec ( 鈥?s鈥?/code> -l %s Last shell option i.e: -- -r Relax security. Make a redistributable binary 锛堝彲浠ョ浉鍚屾搷浣滅郴缁熺殑涓嶅悓绯荤粺涓墽琛岋級 - v Verbose compilation 锛堢紪璇戠殑璇︾粏鎯呭喌锛?/code> -D Switch ON debug exec calls [OFF] -T Allow binary to be traceable [no] -C Display license and exit -A Display abstract and exit -h Display help and exit Environment variables used: Name Default Usage CC cc C compiler command CFLAGS <none> C compiler flags Please consult the shc(1) man page. 璇存槑锛?/code> 缁忔祴璇曪紝鐩稿悓鍦ㄦ搷浣滅郴缁燂紝shc鍚庣殑鍙墽琛屼簩杩涘埗鏂囦欢鐩存帴鍙互绉绘杩愯锛屼絾涓嶅悓鎿嶄綔绯荤粺鍙兘浼氬嚭鐜伴棶棰橈紝 姣斿灏嗕笂闈㈢殑 test .sh.x鐨勪簩杩涘埗鏂囦欢鍦–entOS6.9涓婂姞瀵嗗悗绉诲埌redhat as5u4涓婁笉鑳借繍琛岋紝鍑虹幇 "Floating point exception" 閿欒鎻愮ず锛?/code> 浣嗙Щ鍒板彟涓€鍙癈entOS6.9涓婄洿鎺ヨ繍琛屾病闂銆?/code> |
鏂规硶浜旓細 ZIP鍔犲瘑
1锛夋枃浠跺姞瀵?/span>
浣跨敤鍛戒护"zip -e filename.zip filename" 鍗冲彲鍑虹幇杈撳叆瀵嗙爜鐨勬彁绀猴紝杈撳叆2娆″瘑鐮併€?姝ゆ枃浠跺嵆琚姞瀵嗚В鍘嬫椂鍊欐槸闇€瑕佸瘑鐮佺殑
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
涓嬮潰寮€濮嬩负 test .txt鏂囦欢杩涜鍔犲瘑 [root@centos6-vm02 ~] # cat test.txt this is a test !!! [root@centos6-vm02 ~] # zip -e test.txt.zip test.txt //濡備笅杩涜鍔犲瘑鎿嶄綔鏃讹紝闇€瑕佽緭鍏ヤ袱娆″瘑鐮?/code> Enter password: Verify password: adding: test .txt (stored 0%) [root@centos6-vm02 ~] # ls test .txt test .txt.zip 杩涜瑙e帇鐨勬椂鍊欙紝闇€瑕佽緭鍏ュ瘑鐮?/code> [root@centos6-vm02 ~] # rm -f test.txt [root@centos6-vm02 ~] # unzip test.txt.zip Archive: test .txt.zip [ test .txt.zip] test .txt password: extracting: test .txt [root@centos6-vm02 ~] # cat test.txt this is a test !!! |
2锛夋枃浠跺す鍔犲瘑
浣跨敤鍛戒护"zip -re dirname.zip dirname"鍗冲彲鍑虹幇杈撳叆瀵嗙爜鐨勬彁绀猴紝杈撳叆2娆″瘑鐮併€?姝ゆ枃浠跺嵆琚姞瀵嗚В鍘嬫椂鍊欐槸闇€瑕佸瘑鐮佺殑銆?/span>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
涓嬮潰寮€濮嬪鐩綍杩涜鍔犲瘑 [root@centos6-vm02 ~] # mkdir dirtest [root@centos6-vm02 ~] # cat dirtest/haha.txt this is test of dir !!! [root@centos6-vm02 ~] # zip -re dirtest.zip dirtest Enter password: Verify password: adding: dirtest/ (stored 0%) adding: dirtest /haha .txt (stored 0%) 瑙e帇鐩綍鏃堕渶瑕佽緭鍏ュ瘑鐮?/code> [root@centos6-vm02 ~] # rm -rf dirtest [root@centos6-vm02 ~] # unzip dirtest.zip Archive: dirtest.zip creating: dirtest/ [dirtest.zip] dirtest /haha .txt password: extracting: dirtest /haha .txt [root@centos6-vm02 ~] # ls dirtest haha.txt [root@centos6-vm02 ~] # cat dirtest/haha.txt this is test of dir !!! |
鏂规硶鍏細GnuPG鍔犲瘑
GnuPG鐨勫叏绉版槸GNU闅愮淇濇姢(GNU
Privacy
Guard)锛屽父甯歌绉颁负GPG锛屽畠缁撳悎浜嗕竴缁勫姞瀵嗚蒋浠躲€傚畠鏄敱GNU椤圭洰鐢–缂栫▼璇█缂栧啓鐨勩€傛渶鏂扮殑绋冲畾鐗堟湰鏄?.0.27銆傚湪濡備粖鐨勫ぇ澶氭暟Linux鍙戣鐗堜腑锛実nupg绋嬪簭鍖呴兘鏄粯璁ら殢甯︾殑锛屾墍浠ヤ竾涓€瀹冩病鏈夊畨瑁咃紝浣犲彲浠ヤ娇鐢╝pt鎴杫um浠庤蒋浠跺簱鏉ュ畨瑁呭畠锛坹um
install gnupg锛夈€傛敞鎰忥細gpg鍙兘瀵规枃浠惰繘琛屽姞瀵嗭紝瀵圭洰褰曞垯鏃犳硶瀹屾垚鍔犲瘑锛?/span>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
涓嬮潰寮€濮嬩娇鐢℅nuPG鏂瑰紡瀵?/code> [root@centos6-vm02 ~] # cat test.txt this is a test !!! [root@centos6-vm02 ~] # gpg -c test.txt can 鈥榯 connect to `/root/.gnupg/S.gpg-agent鈥?/code> 娉ㄦ剰锛氬涓婂姞瀵嗙殑鏃跺€欙紝浼氬脊鍑烘潵涓€涓璇濇锛岃姹侾araphrase杈撳叆涓ゆ瀵嗙爜锛屽杩欎釜鐗瑰畾鐨勬枃浠惰繘琛屽姞瀵嗐€?/code> 涓€鏃﹁繍琛屽甫-c閫夐」(瀹屽叏浣跨敤瀵圭О瀵嗙爜绠楁硶鍔犲瘑)鐨刧pc鍛戒护锛屽畠浼氱敓鎴愪竴涓枃浠?gpg鏂囦欢銆?/code> [root@centos6-vm02 ~] # ll test.txt* -rw-r--r--. 1 root root 18 Jan 4 10:08 test .txt -rw-r--r--. 1 root root 61 Jan 4 10:04 test .txt.gpg 瀵规枃浠惰繘琛屽姞瀵嗗悗锛屾渶濂藉皢婧愭枃浠跺垹闄わ紒涓嶈鍐嶄繚鐣欐簮鏂囦欢浜嗭紒 [root@centos6-vm02 ~] # rm -f test.txt 鏂囦欢瑙e瘑鎿嶄綔銆?/code> 娉ㄦ剰鍑虹幇Paraphrase鎻愮ず鏃讹紝闇€瑕佹彁渚涘姞瀵嗘椂杈撳叆鐨勫悓涓€涓瘑鐮佹墠鑳借В瀵?/code> [root@centos6-vm02 ~] # gpg test.txt.gpg gpg: 3DES encrypted data can 鈥榯 connect to `/root/.gnupg/S.gpg-agent鈥?/code> gpg: encrypted with 1 passphrase gpg: WARNING: message was not integrity protected [root@centos6-vm02 ~] # ll test.txt* -rw-r--r--. 1 root root 18 Jan 4 10:08 test .txt -rw-r--r--. 1 root root 61 Jan 4 10:04 test .txt.gpg [root@centos6-vm02 ~] # cat test.txt this is a test !!! |
以上是关于linux涓嬫枃浠跺姞瀵嗘柟娉曟€荤粨的主要内容,如果未能解决你的问题,请参考以下文章
WINDOS涓嬭嚜鍔ㄥ浠芥枃浠跺強鍒犻櫎涔嬪墠鐨勬枃浠?bat