LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-02-2015, 02:05 PM   #1
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Rep: Reputation: 32
Post File Permissions.


Hey guys.

A quick question.. I have a folder with perm 755 , however I need any newly created file in that directory you have the permissions 222 (Write only).

Folder: foo (755)
File: foo/me.txt (222)

I need it to be automatic not - manual chmod.

Note:
FS = ext3
OS = CentOS6
SElinux - Disabled (not planning to use it)

Thanks guys
 
Old 03-02-2015, 02:26 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
There is no purpose to a write only file...

If you can write to it, you can replace the contents.
 
Old 03-02-2015, 03:22 PM   #3
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
I have a script running on my cloud server that runs chmod 777 on all the files on its SMB share. Goes something like this:

Code:
#!/bin/bash
#chperms.sh
func() {
sudo chmod 777 -R ~/smbserver
sleep 5
func
}
func
The script will quit every 24 hours or so, but it works while the script is going.
 
Old 03-02-2015, 03:44 PM   #4
cepheus11
Member
 
Registered: Nov 2010
Location: Germany
Distribution: Gentoo
Posts: 286

Rep: Reputation: 91
Read docu about umask: This specifies the permission bits to be subtracted from newly created files and directories. After

Code:
umask 555 # do not try this at home, useless
you get -w--w--w- files and directories. Which is useless, because they cannot be accessed. It is not secure also, because the owner (=creator) can change permissions with chmod.
 
Old 03-02-2015, 03:45 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You should be getting errors with that... like "stack overflow"

And it is rather insecure - as anyone can change anything in the tree. Even add viruses.
 
Old 03-02-2015, 03:48 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by Ihatewindows522 View Post
I have a script running on my cloud server that runs chmod 777 on all the files on its SMB share. Goes something like this:

Code:
#!/bin/bash
#chperms.sh
func() {
sudo chmod 777 -R ~/smbserver
sleep 5
func
}
func
The script will quit every 24 hours or so, but it works while the script is going.
Sorry - should have quoted:

You should be getting errors with that... like "stack overflow". Normally you would do a two pass operation as
Code:
sudo chmod 777 -R ~/smbserver
sudo chmod 777 -R ~/smbserver
Instead of using a recursive script without a termination test...

And it is rather insecure - as anyone can change anything in the tree. Even add viruses.
 
Old 03-02-2015, 04:44 PM   #7
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by jpollard View Post
Sorry - should have quoted:

You should be getting errors with that... like "stack overflow". Normally you would do a two pass operation as
Code:
sudo chmod 777 -R ~/smbserver
sudo chmod 777 -R ~/smbserver
Instead of using a recursive script without a termination test...

And it is rather insecure - as anyone can change anything in the tree. Even add viruses.
Hi guys,
}
Thanks for the update - creating a script and cronning it will work, there must be a way of doing

In addition - If the option is there then (there is a use for it). you can change content - only if you know what file you are changing .

i looking in to gsid - or stiky node but does not seem to work.


I was just wondering if this could be done.

Thanks again .
 
Old 03-04-2015, 04:43 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
incron / inotify

Quote:
Originally Posted by Ihatewindows522 View Post
I have a script running on my cloud server that runs chmod 777 on all the files on its SMB share. Goes something like this...
The script will quit every 24 hours or so, but it works while the script is going.
Or you could install incron and have an incrontab set to run any time a file is added to the directory. That way there will be little to no delay.
 
Old 03-04-2015, 04:43 AM   #9
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
incron / inotify

Edit: PHP error on the site caused a duplicate post.

Last edited by Turbocapitalist; 03-04-2015 at 04:47 AM.
 
Old 03-13-2015, 04:25 PM   #10
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
Quote:
Originally Posted by jpollard View Post
Sorry - should have quoted:

You should be getting errors with that... like "stack overflow". Normally you would do a two pass operation as
Code:
sudo chmod 777 -R ~/smbserver
sudo chmod 777 -R ~/smbserver
Instead of using a recursive script without a termination test...

And it is rather insecure - as anyone can change anything in the tree. Even add viruses.
If they can get past the layers of security. User names are cryptic, and the passwords even more so, and they change regularly. Different users for different services. There is no root account. Only I know the IP, which can change as often as I like. That's just to name a few little security features I have.

Anyone trying to hack it is going to get a surprise. I'm a hacker, I do this for a living. I don't think I have an issue with security at the minute. I also want full control over my files. If I don't give myself permission, I can't access my files from the locations that I would like, or via Tor if I need to.

Also, if I got an error, pretty sure I would modify the script so that I no longer get the error.
 
Old 03-13-2015, 04:36 PM   #11
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,264
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Just my opinion, but...

Quote:
Originally Posted by Ihatewindows522 View Post
If they can get past the layers of security...
That is only the illusion of security, but no meaningful, manageable, testable security at all...

Quote:
Originally Posted by Ihatewindows522 View Post
Also, if I got an error, pretty sure I would modify the script so that I no longer get the error.
Only if you become aware of it before it does actual harm.
 
Old 03-13-2015, 05:02 PM   #12
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
Quote:
Originally Posted by astrogeek View Post
Just my opinion, but...
That is only the illusion of security, but no meaningful, manageable, testable security at all...
It means something if it's proven that it works. I can manage it just fine. I've tested it, it works. Are you volunteering to test it?


http://www.merriam-webster.com/dictionary/security

: the state of being protected or safe from harm - pretty sure my server protected and safe from harm.

: things done to make people or places safe - Strong password, hardware firewall (didn't mention that before), and whatever I added previously. Illusion? Really?? Relative security, yes. Absolute security, absolutely not.

: the area in a place (such as an airport) where people are checked to make sure they are not carrying weapons or other illegal materials - You're checked at the login screen. You fail 5 times you're out for about a minute. A pain to hack unless you are a professional who is familiar with the low-level workings of a UNIX system, and can manipulate it over a network. Very few people can do this, and the vast majority charge big bucks and/or work for the NSA. You're not from the NSA are you? The average script kiddy that would try to hack a SSH server using common login/passwords would utterly fail at this. My password isn't root123, it's more like &UJM5tgb&UIJK<0p;/&^YUHJN (only a little longer). Try that one with ophcrack.
 
Old 03-13-2015, 05:19 PM   #13
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,264
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Sorry, it was not my intention to upset you, and I know nothing about your security except what was stated in previous posts here.

Based on that information, and especially with what you have added I would stand by my observation that you are at least partly operating under the illusion of security.

My comments were intended to be helpful to yourself and anyone else who might read this thread, not to pick an argument, so I'll step out now.

Best of luck to you!
 
  


Reply



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
File Permissions- Once again the Permissions questions?? fusionstate Linux - Newbie 2 01-04-2014 12:47 PM
chmod: changing permissions of `/usr../bin': Read-only file File System Issue cdhar Linux - Newbie 3 12-31-2012 06:17 AM
SMB - File copy from Windows file permissions changed? tiger.woods Red Hat 1 12-04-2012 06:18 AM
File permissions v. directory permissions Completely Clueless Linux - Newbie 7 07-09-2009 08:33 AM
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:48 AM.

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
Open Source Consulting | Domain Registration