LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2015, 03:40 AM   #1
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Rep: Reputation: Disabled
file permission


I am writing a script to check the log file in /var/log , some files are only read by root , but the script use general user to access the system ( as the system do not accept root to ssh directly ) , therefore , it could not read such files .

Would advise what is the best method to solve this problem , copy the file to a special folder ? allow root to ssh ? create a user with root permission ?

very thanks
 
Old 02-02-2015, 04:12 AM   #2
QYInst
LQ Newbie
 
Registered: Jan 2015
Posts: 17

Rep: Reputation: Disabled
Do you run the script at a remote server or local machine?

If it is at a remote server, then you can run the script as root using su command.
Otherwise I have the following suggestions:
1. Enable public key ssh access for root.
2. Running a script at the remote server as root, which copies the log to a file that your account via ssh can read.
 
Old 02-02-2015, 09:37 AM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Usually logs contain sensitive information that why regular users are not allowed to view them.

So as in above post login as root via ssh. Or your can make the logs group permission as read and make your user member of that group.
 
Old 02-02-2015, 09:46 AM   #4
J Martin Rushton
Member
 
Registered: Jan 2015
Location: England
Distribution: Mainly CentOS
Posts: 31

Rep: Reputation: Disabled
Have you looked at logwatch? It is highly customisable if it doesn't do exactly as required.
 
Old 02-02-2015, 11:50 AM   #5
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 813

Rep: Reputation: 264Reputation: 264Reputation: 264
Quote:
Originally Posted by QYInst View Post
...
1. Enable public key ssh access for root.
Uhhh... enabling ssh access for root is usually considered a Bad Idea™
 
Old 02-03-2015, 04:29 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Use sudo instead http://linux.die.net/man/5/sudoers
http://linux.die.net/man/8/visudo
http://linux.die.net/man/8/sudo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ext4 - permission to create/modify a file without 'delete' permission BeachHead Linux - General 4 06-08-2014 07:34 PM
File & Folder Permission and Ownership permission error in Cloud storage. rhcekumaran Linux - Newbie 3 06-14-2013 04:41 AM
[SOLVED] Apache 403 file permission error when accesing a symlink file (CentOS 6.3) mkvakic Linux - Newbie 7 02-13-2013 03:25 AM
Reading ext3 file system on Mac and overriding file permission moravveji Other *NIX 6 09-12-2011 02:25 AM
Any log file for checking file permission change history in RHEL 5.1? bilalcochin Linux - Newbie 3 04-02-2010 09:57 AM


All times are GMT -5. The time now is 02:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration