bash-3.00$ uname -n
Solaris-VM-01
bash-3.00$ cat /etc/release
Solaris 10 5/09 s10x_u7wos_08 X86
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 30 March 2009
bash-3.00$ /usr/ucb/whoami
che
bash-3.00$ mkdir test
bash-3.00$ cd test/
bash-3.00$ pwd
/export/home/che/test
Whenever a file is created through ‘cat’, ‘touch’ commands and ‘vi’ editor (even with other editors) the format of the file is ascii text and hence the content of the file can be viewed htrough ‘cat’ command nor through editors like vi, gedit etc.
For eg:
bash-3.00$ vi file1
welcome to the world of Unix
~
:wq!
bash-3.00$ ls -l
total 2
-rw-r--r-- 1 che unix 29 Jul 26 12:40 file1
bash-3.00$ file file1
file1: ascii text
bash-3.00$ cat file1
welcome to the world of Unix
We can encrypt the file by the following:
bash-3.00$ vi -C test_file1
Enter key:
The DHCP server's configuration information is stored in the /etc/inet/dhcpsvc.conf file. This file is created when the configuration
commands are run and should never be edited manually. This file was the /etc/default/dhcp file prior to the Solaris 9 OS.
~
:wq!
bash-3.00$ file test_file1
test_file1: data
-C option prompts for password and the same has to be issued.
NOTE:
Now even the file is created through vi – editor, the format file is changed and remain in the format: data.
bash-3.00$ vi -x test_file2
Enter key:
The broadcast address for an interface is related to the netmask. If the netmask is changed, the boradcast address must also be changed to
reflect the new network. The simplest way to do this is to use the broadcast + argument to the ifconfig command.
~
:wq!
bash-3.00$ file test_file2
test_file2: data
-x option can also be used for the same purpose.
–x option prompts for password and the same has to be issued.
Once the file in encrypted by using –C and –x options respectively, the contents of the file cannot be viewed normally by the owner of the file and also by root user.
For eg:
bash-3.00$ cat test_file1
LO]$d|@oQH= -65]>ZY{8n<" 1
20bE1
_VF* L<h1?D u7z5;6L
mC}` ;Y%7*A
7 z#V 4i bash-3.00$
bash-3.00# cat test_file1
LO]$d|@oQH= -65]>ZY{8n<" 1
20bE1
_VF* L<h1?D u7z5;6L
mC}` ;Y%7*A
7 z#V 4i bash-3.00#
bash-3.00# vi test_file1
"test_file1" [Incomplete last line] 1 line, 257 characters (3 null)
\260LO]$d|\351@oQH=\357 -\336\27765\330\350]\264\225\323>\307ZY{\2118\305\237\352\235\345^V\253\320\317n\276^Y^E<"^U \306\305\261\223\317\313\2421^K\204\3252\3360b\210\253E1\213\203^L_\371VF^G*^T\204\203\220^O\357L<\244\245h1\357\330\201^V\325?\356\253\255\353\227D\227\202\364^Y
^H\270\346\365\233\344u^_\3507z5^Z^Y;\310\204\273^X6\347L^M^L\324^?^W\340^UD^M\313}\375\310\300^M\321V2\303K8^M\355\251\373\2379^Y\350\233\330\341x.[\273fX\355^A,\336\335\254\261\321\320hn\315\253`\252^C\255\224J\204\315\320\211\216\365\206^VX\317\217p^Mm\313\317\371\255\343\260\315C\313}^X\234`^U\221;Y%7\337\356*A\267\352\236^D\372\250^?^Z\326\2347\323\250\303^S\357z\255\276#\372V ^Y\330\3124\367i \270
:q!
We know, ‘strings’ command can be used to view the content of the file in the format : data.
For eg,
bash-3.00$ file /var/adm/wtmpx
/var/adm/wtmpx: data
bash-3.00$ strings /var/adm/wtmpx |more
system boot
run-level S
run-level S
run-level S
run-level 3
zsmon
PM10
.startd
co10
.startd
co10
0LOGIN
co10console
LOGIN
console
root
console
root
pts/3
:0.0
run-level 5
root
console
root
pts/3
(Output truncated)
But, whilst the files are encrypted even ‘strings’ command cannot display the desired output.
For eg:
bash-3.00$ strings test_file2
LO]!
bash-3.00$ strings test_file1
LO]$d|
@oQH=
Hence to view the contents of the file –C or –x option has the used through vi editor along with the encrypted key.
For eg:
bash-3.00# /usr/ucb/whoami
root
bash-3.00# uname -n
Solaris-VM-01
bash-3.00# vi -x test_file1
Enter key:
"test_file1" 2 lines, 257 characters
The DHCP server's configuration information is stored in the /etc/inet/dhcpsvc.conf file. This file is created when the configuration
commands are run and should never be nedited manually. This file was the /etc/default/dhcp file prior to the Solaris 9 OS.
:q!
It works...!!!