LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-27-2004, 03:57 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
samba share with write but not delete


Is there a way to set a samba share so you can write, but not delete? I want to make a backup share so automated programs can put all the backups there, but I don't want it to be possible for anything or anyone to delete them. I only want to be able to delete from linux (ex: going into ssh and using the rm command).

Is there a way this can be done?

Right now the way I have it is that I have a folder with write permissions that backups go to, then every day a script runs to move the files to a safer location, but I rather not have to move stuff twice like that.

Thanks in advance.
 
Old 08-27-2004, 08:36 PM   #2
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: Linuxmint, Slackware
Posts: 356

Rep: Reputation: 34
Try this as root user:

# mkdir -p /usr/local/samba/backup
# chmod 1770 /usr/local/samba/backup

Put these in your smb.conf file under share definitions:

[Backup]

commnent = Backup file that only root can access
path = /usr/local/samba/backup
public = no
valid users = root @root
force create mode = 0770
force directory mode =0770

Hope this works.
 
Old 08-27-2004, 10:39 PM   #3
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Yeah but now nobody can access it period I still need to be able to access it from anywhere I just don't want to be able to delete, only write.

Is there something like "delete=no" that I could use?
 
Old 08-28-2004, 02:13 AM   #4
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: Linuxmint, Slackware
Posts: 356

Rep: Reputation: 34
Are you logon as root? It's root that should only do the backup in this case beacause the "world" permission is "0" - no access, no other user and group that could access this, except root user and its built-in group.

Will you allow others to put their files here ( as you said as backup )? If they have write access to this directory, they can also delete the files they wrote.

Since in the first place you wanted that this will be used only as a central backup directory and you don't want anybody to be able to delete any content except only when you're logged on in Linux box, then root should only be the user that should be permitted or granted full access.
 
Old 08-28-2004, 02:25 AM   #5
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: Linuxmint, Slackware
Posts: 356

Rep: Reputation: 34
The public = no assures that this is not a public directory for everybody, only the one that owns this. The valid users = root @root assures that only the user root and its built-in (root) group will only have access. And since you're loged-on as root the time you created this this directory, by default this is owned by root and its group.

If you can't still access this as root, try to omit the "public = no" parameter or do this:

# chmod 1775 /usr/local/samba/backup - I suggest you do this first.
 
Old 08-28-2004, 11:09 AM   #6
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
So to access it I would just make a user in windows called root and make the backup happen under that user? (using scheduled tasks). But for my samba shares I use share level security and not user based so will it still work?

I figured this would be much simpler,
 
Old 08-28-2004, 11:31 AM   #7
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: Linuxmint, Slackware
Posts: 356

Rep: Reputation: 34
No need to create a local root user in Windows. I'm not so sure. I thought it should be 777 permission if security is only share. To make sure, your security should be user and create all your windows users in Linux and in smbpasswd but give them different password from their unix passwords.

Then let them take ownership of their respective directories (# chown -R username.users). The user group is a built-in group in unix with GID=100 (see /etc/group).

Finally make your bakcup directory in Linux owned by root.root only (actually the default).
 
Old 08-29-2004, 06:12 PM   #8
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
I was playing around and found an easier solution.


create mode =555

So it creates the files as read only so they can't be deleted. It does not seem to work for folders, but folders are less important then files, and if a folder contains a file it won't let me delete it. So it's exactly what I want.

I've been playing with stuff and have other questions but I'll start a new thread.
 
  


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
Can't write to Samba Share perihelion Linux - Software 21 03-12-2012 10:39 AM
can't mount samba share and then write to the share calbazon Linux - Software 8 10-10-2010 01:35 AM
Help required with samba... deny delete but allow write? NuLLiFiEd Linux - Networking 5 07-04-2005 04:53 PM
Can't write to Samba share erikcw Linux - Software 3 01-26-2005 03:59 AM
samba guest directory once write then no delete ilnli Linux - Networking 1 08-30-2004 01:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:45 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