How to Identify the access level to specific file/directory in UNIX ?
To identify what are the access permissions to specific file or directory for a logged in user in UNIX environment, Follow below steps
- Login to unix box
- Issue command : ls -la
- You will notice all the list of files/directories as shown below screenshot,
- First character specifies whether it is file or directory, If it is directory, it will show as 'd' otherwise just emply
- Next three characters represents access permissions to logged in user, r - read, w - write, x - execute
- Next three characters represents access permissions to the group (i.e appigroup)
- Last three characters represents access permissions to anybody, empty means no access.
- Issue below commands to give access to Group(g), Owner(o) & Others (a) as below
chmod rw+o TMP - Give read write permissions to owner for 'TMP' directory/file name
chmod rwx-a TMP - Remove read,write, execute permissions on 'TMP' directory/file for others
chmod 700 TMP - Give read,write, execute permissions on 'TMP' directory/file to owner , and no access to others & group
Useful UNIX commands
- To convert dos based file to unix
i. Create temporary file first eg : temp.xml
ii. temp.xml << dos2unix build.xml
This will convert build.xml ( which is based on window/dos OS) to temp.xml
- hostname - Print the host name
- ssh uxunt540 - connect to uxunt540 unix box
- To give a sudo access to specific user
sudo su - <userName>
-To Copy a existing file
cp <sourceFileName> <targetFileName>
- To Grep for specific content in a current directory
ps -ef | grep 'Fortune Minds' - This will search for 'Fortune Minds' string in all the directories and files in a current present working directory
- To know the present working directory
pwd
- To find out specific file content or forlder
whereis <FortuneMinds> - This will find out files/folders which contains 'Fortune Minds' and list out all the findings.
- To Edit a specific file
vi FortuneMinds.txt
Press 'I'
Modify the file
Esc,Shift+:, wq!
- To backup a directory
mv <source_folder_Name> <target_folder_Name>
- To run any shell script
./startWebLogic.sh & - startWebLogic shell script will run in background.
To identify what are the access permissions to specific file or directory for a logged in user in UNIX environment, Follow below steps
- Login to unix box
- Issue command : ls -la
- You will notice all the list of files/directories as shown below screenshot,
- First character specifies whether it is file or directory, If it is directory, it will show as 'd' otherwise just emply
- Next three characters represents access permissions to logged in user, r - read, w - write, x - execute
- Next three characters represents access permissions to the group (i.e appigroup)
- Last three characters represents access permissions to anybody, empty means no access.
- Issue below commands to give access to Group(g), Owner(o) & Others (a) as below
chmod rw+o TMP - Give read write permissions to owner for 'TMP' directory/file name
chmod rwx-a TMP - Remove read,write, execute permissions on 'TMP' directory/file for others
chmod 700 TMP - Give read,write, execute permissions on 'TMP' directory/file to owner , and no access to others & group
Useful UNIX commands
- To convert dos based file to unix
i. Create temporary file first eg : temp.xml
ii. temp.xml << dos2unix build.xml
This will convert build.xml ( which is based on window/dos OS) to temp.xml
- hostname - Print the host name
- ssh uxunt540 - connect to uxunt540 unix box
- To give a sudo access to specific user
sudo su - <userName>
-To Copy a existing file
cp <sourceFileName> <targetFileName>
- To Grep for specific content in a current directory
ps -ef | grep 'Fortune Minds' - This will search for 'Fortune Minds' string in all the directories and files in a current present working directory
- To know the present working directory
pwd
- To find out specific file content or forlder
whereis <FortuneMinds> - This will find out files/folders which contains 'Fortune Minds' and list out all the findings.
- To Edit a specific file
vi FortuneMinds.txt
Press 'I'
Modify the file
Esc,Shift+:, wq!
- To backup a directory
mv <source_folder_Name> <target_folder_Name>
- To run any shell script
./startWebLogic.sh & - startWebLogic shell script will run in background.
great tips about full stack At SynergisticIT we offer the best full stack training in california
ReplyDelete