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


Similar Content



How To Get Around Tar'ing Up Files You Don't Have Permissions?

I would like to tar up some system logs with core files as a normal user through a script. However these core files are owned by root.

Of course I get "cannot read directory ...: Permission denied"

Is there a good way to grab these core files through a script? From searching around, I get that the best way is to modify the sudoers file, then run the script with sudo. Is this considered the safest and best way?

Thanks!

Securing /etc/profile And /etc/bashrc

Changing umask value for files and directories take effect after reload:
/etc/profile
/etc/bashrc
default permission for all users:
-rw-r--r--
above permission is edited to:
-rw-rw-r--
If a specific user in group having only read permission to a file/directory is created before reload,and Linux server reloads, that user gets rw permission to that file/directory. what is the alternative of securing:
/etc/profile
/etc/bashrc
apart from giving the two files access to root user only, and locking out all other users?

Normal Linux User Recursively Write Access To Apache Document Root

I tried adding two users in apache group and given 775 permission to Document root but user is not able to write into files in DocumentRoot

Tried adding user and DocumentRoot Folder in sudo file but not able to do it recursively

please help


Thanks for reply,
I have already given chmod 775 -R DocumentRoot - for recursively writting permission
You have told to add user in www-data group and chmod 775 -R to DocumentRoot
usermod -a -G www-data <user1>

How can users in www-data can able to write in DocumentRoot which has apache:apache owner and group
please clarify...

Done below steps to solve this:
1) I have created a new group webdata and added required users in this group
2) set sticky bit to document root with below command
setfacl -m g:webdata:rwx -R /path/to/documentroot/
this command will set rwx permission to DocumentRoot so that members in webdata can have full access but still DocumentRoot user and group will be apache

Folder Not Readable Or Writable By Any Other System Users

Hi all. I am tweaking my php.ini file and I do not understand the bolded text below...

http://phpsec.org/projects/phpsecinf...d_tmp_dir.html
Quote:
upload_tmp_dir

Test Description
Checks if the current upload_tmp_dir is a world readable or writable folder, and if it matches the common UNIX system temp directory.

Security Implications
upload_tmp_dir allows you to specify where uploaded files should be saved until the handling script moves them to a more permanent location. If this file is within the document root of the web site and/or accessible to system users other than PHP's user, it could be modified or overwritten while PHP is processing it. By default upload_tmp_dir is set to the system's standard temporary directory, which can typically be accessed by all system users.

Recommendations
Set upload_tmp_dir to a folder that is:
- outside the document root of your web site
- not readable or writable by any other system users

You can set upload_tmp_dir in the php.ini file:

; Set upload_tmp_dir to a safe location
upload_tmp_dir = /var/www/foo.bar/sessions

The setting can also be applied in apache's httpd.conf file, or an .htaccess file:

# Set upload_tmp_dir to a safe location
php_value upload_tmp_dir /var/www/foo.bar/sessions

Questions:
1.) What does the bolded text mean, and how do I do that?

**NOTE: I don't have VPS Root access, and am hoping this can be done using my regular account via SSH.

2.) Where would be a safe place to put these temporary files?

Sincerely,


Rob

Rsync Copy Permission Denied

hi experts

I am rsyncing a user's home dir across the NFS and the local PC, but when it tries to copy over the hidden files it fails with permission denied. Both dir are owned by the proper user and I am root when I execute the script, so I am not sure what went wrong here.
For example: this is the content and permissions of the source:

-rw------- 1 user test 115 Nov 14 11:28 .bash_history

and here is my error:

rsync: send_files failed to open "/home/user/.bash_history": Permission denied (13)

Thanks

I Set Up An Ext4 Partition On External HD To Store Media Files. Permission Issues

I recently bought a WD external hard drive for storing file of several types. Using gparted I made two partitions, one ntfs for windows files and an ext 4 for linux files. Strangely, I have complete access to ntfs partition from linux side of duel boot system, but do not have permission to access ext4 partition. My root password does not work when I use su to gain root access. It works fine on built in hard drive.

Centos File Permission Issue

Hello There


I have an issue in file permission,I have configured an samba share drive,
created user and then shared it with other network computer(WINDOWS 7)

whenever an user creates an folder or file (like Excel) it shows up in read only mode..

I have ran the command :- chmod -R 777 <sharedFolder>

still when the users create a new folder, other cannot edit or modify the file

need help

Become A Root Wiht Public Key Access

Hello Everyone,

I have a question about how to give sudo privileges to a user that log in via public key without password.

I created a normal user and I added this user to the "visudo" folder with ALL privileges.

when the user is logged in the system via public key and the user wants to become a root, a password is requested but i don't want to type the password.

Also to add the public key to the root it is not possible because i track the user log in in the system and if they log via root i cannot do that.

Thank you in advance.

Cannot Get Root To Work

I have been getting permission denied issues when trying to log into as root. I have set my password and when I type su - root and enter in my password I keep getting either password incorrect when I know I am typing it in correctly or acess permission denied from su. Can anyone explain what I am doing wrong. I am trying to get into /etc/passwd for homework assignment and I get permission denied when logged in as my user. Any help will be great. I have in the past been able to logg in to root but now I cant seem to get into it. This is a new install of ubuntu 14

Added 'exit 0' To The Bottom Of .bashrc, Now What?

Centos 6.5

I ran into an interesting problem (on reddit) that I figured I could solve, but I have not been able to. Its simple,.. I added 'exit 0' to /root/.bashrc, and now I am trying to log in via ssh.

Everytime I do, it immediately exits when it runs the .bash_profile, which sources .bashrc, (which is immediate upon 'logging in')

I've tried:

Code:
ssh root@192.168.1.50 -t vim
vim scp://192.168.1.50/.bashrc
vim scp://192.168.1.50/root/.bashrc
ssh root@192.168.1.50 bash --norc
ssh root@192.168.1.50 /bin/bash --norc --noprofile
ssh -T root@192.168.1.50 "mv /root/.bashrc /root/.bashRC"
scp .bashrc root@192.168.1.50:/root/
ssh root@192.168.1.50 /bin/bash --norc --noprofile -vvvvvvvvvv
ssh -vvvvvv root@192.168.1.50 /bin/bash --norc --noprofile
ssh -vvvvvv root@192.168.1.50 /bin/mv /root/.bashrc /root/.bashRC
ssh -t -t root@192.168.1.50 << EOF
mv /root/.bashrc /root/.bashRC
EOF
ssh -t -t root@192.168.1.50 --norc << EOF
echo HELLO > /root/.bashrc
EOF
ssh -tv root@192.168.1.50 rm .bashrc

So,.. I am unable to get back into the system (as root, no other users exist) after adding 'exit 0' to .bashrc

Anyone feel like explaining why all of these failed (aside from saying SSH interactive logins run the .bash_profile/.bashrc files) or, offering a suggestion that works? Seems like if you have the root password, you should be allowed to modify the login process... since... you know... you are root.