There are several ways to change the permission of a file in Linux. But I feel following way is more clear and easy.
Let's Consider following file.
-rw-------. 1 udara udara 3066 Mar 25 10:07 settings.xml
After the initial dash,
First 3 places denoted permission for 'user' level
next 3 places denoted permission for 'group' level
last 3 places denoted permission for 'other' level
'r' indicates permission for read
'w' indicates permission for write
'x' indicates permission for execute
So, to change the permission for the file we can use following code syntax.
With the following command we are going to provide execute permission for above file only for 'user' level.
chmod u+x settings.xml
'u' is for 'user', there can be 'g' (group), 'o' (other)
'+' is to indicate add a permission and '-' is to indicate remove a permission
'x' is for execution permission. There can be r,w,x characters.
-rwx------. 1 udara udara 3066 Mar 25 10:07 settings.xml
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
Thursday, March 31, 2016
Sunday, August 24, 2014
How to Validate a Server
Validate a Server can be an important task when you are going to install a commercial applications with license only for specified servers. To validate a server we have to identify unique attributes related to servers. We can find unique attributes for a server both from software and hardware levels. Hardware level validation can be more reliable than software level since software level data can be easily fraudulently changed than the hardaware level data. But your selection may dependent on your requirements.
With this post I am describing how you can validate a server with hardware information. Simply you can access to Systems' hardware informations. As an example in Linux operating systems you can execute "dmidecode" and get the system information list (you can implement an application to execute those command programmatically using any programming language).
Then you can identify unique data elements related to a server like Serial Key, UUID, MAC etc.
You have to do a strign manipulation and retrive the those required values from the System information list.
Then for the best security we can encrypt that value and also create a hash value from it. Now, we have a pre created and authenticated hash value. When ever we need to validate the server, what we have to do is dynamically create the hash value and compare with our stored pre-validated hash value.
If the two hashes are equal then the server validation is passed. If not server validation is false.
With this post I am describing how you can validate a server with hardware information. Simply you can access to Systems' hardware informations. As an example in Linux operating systems you can execute "dmidecode" and get the system information list (you can implement an application to execute those command programmatically using any programming language).
Then you can identify unique data elements related to a server like Serial Key, UUID, MAC etc.
You have to do a strign manipulation and retrive the those required values from the System information list.
Then for the best security we can encrypt that value and also create a hash value from it. Now, we have a pre created and authenticated hash value. When ever we need to validate the server, what we have to do is dynamically create the hash value and compare with our stored pre-validated hash value.
If the two hashes are equal then the server validation is passed. If not server validation is false.
Labels:
hardware,
linux,
MAC,
serial key,
server,
UUID,
validation
Saturday, April 26, 2014
Shell script to record linux top to a text file continuously after a given time
We can record the whole top or a specific process with a process ID or process name. You can customize this code with existing shell commands related to linux shell command options relate with top "top".
Refer to http://linux.about.com/od/commands/l/blcmdl1_top.htm
Replace
[1] with the name of the process.
[2] with the name of the text file where the output is need to be recorded.
If you need to track the process just with the process id use below script.
Replace
[3] with the id of the process.
To start this batch process via shell type
Replace
[1] with the name of the process.
[2] with the name of the text file where the output is need to be recorded.
while [ 1 ] do
top -n 1 -p $(pidof firefox[1]) -b >> topoutput.txt[2] sleep 0.1 done If you need to track the process just with the process id use below script.
Replace
[3] with the id of the process.
while [ 1 ] do
top -n 1 -p 2304[3] -b >> topoutput.txt[2] sleep 0.1 done
Write above codes with your favourite text editor and save it with .shTo start this batch process via shell type
bash <file name of the shell script>.sh
Subscribe to:
Posts (Atom)