DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-05-27 06:47:23

krackpot
Member
Registered: 2009-01-24
Posts: 44

Separate Read-only and Write access to the Volumes

Is there any easy way to have read-only access to "Volume_1" while having write access to the same "Volume_1" through Windows?


DNS-323 (B1) on Alt-F 0.1B7
2x2TB WD20EARS

Offline

 

#2 2011-05-27 09:31:42

krackpot
Member
Registered: 2009-01-24
Posts: 44

Re: Separate Read-only and Write access to the Volumes

Figured it out on my own.

Create a folder in /mnt
Mount /dev/sda2 (Volume_1) to the folder you created in /mnt
Test
Go to Samba services and add read-only
Edit /etc/fstab
Save the settings in Alt-F
Map the folders in Windows


DNS-323 (B1) on Alt-F 0.1B7
2x2TB WD20EARS

Offline

 

#3 2011-05-27 17:00:43

jcard
Member
From: Portugal
Registered: 2008-09-21
Posts: 289

Re: Separate Read-only and Write access to the Volumes

krackpot wrote:

Is there any easy way to have read-only access to "Volume_1" while having write access to the same "Volume_1" through Windows?

Samba (Windows) can't have write access if the filesystem (Volume_1) is mounted read-only.

Figured it out on my own.

Create a folder in /mnt
Mount /dev/sda2 (Volume_1) to the folder you created in /mnt
Test
Go to Samba services and add read-only
Edit /etc/fstab
Save the settings in Alt-F
Map the folders in Windows

I don't understand what you want to do, but changes to /etc/fstab are not persistent across reboots. Only external filesystems such as NFS and CIFS are preserved, as local filesystems might change if you change or swap disks.

Whenever a disk/filesystem is detected, Alt-F automatically mounts it and changes /etc/fstab. The mount point is the filesystem partition name (such as sda2) or the filesystem label, if there is one.
Thus, Volume_1, which uses to be sda2 for a "standard" disk layout, will be automatically mounted in /mnt/sda2.

If you want to change the mount options, you should do it in Disk->Filesystems->Mount Options, then "FS Operations->Set Mnt opts" and changes will survive reboots.

If you swap or change disks, sda2 might become sdb2, but mount options will survive changes, although the mount point will not; it is thus advisable to set a label to filesystems, also using Disk->Filesystems->Label, then FS Operations->Set Label.

As for Samba, you might want to move (editing) the

#!# extra shares, don't change anything above, dont remove me

comment in /etc/samba/smb.conf after the *end* of the [Printers] section; you will then be able to edit all shares using the web interface.

You can then add a share in Services->Network->smb->Configure, and in the section "Directories to export to other hosts", hit the Browse button and select a mountpoint, such as /mnt/sda2. (Or, if you set Volume_1 as a label to sda2, /mnt/Volume_1)

I know that more options are needed in this web page section, but there are so many options in samba and so little space to put them... what is missing?


Please consider discussing Alt-F at http://groups.google.com/group/alt-f/topics
Please consider filling Alt-F bugs at http://code.google.com/p/alt-f/issues/list

Offline

 

#4 2011-05-30 06:57:39

krackpot
Member
Registered: 2009-01-24
Posts: 44

Re: Separate Read-only and Write access to the Volumes

I just want a read only of Volume 1 + Volume 2 (say Y: and Z: ), and I don't want to mess with users/permissions. Some of my Windows programs will write metadata or other garbage to the folders and files and Macs will write their cache files in them. So if I make those two partitions read-only, they'll be able to browse, play mp3s etc, but just won't be able to change anything.

But I also want the ability to write to those in a different mapping in windows (say W: and X: ).

I don't think I can set multiple mountpoints to the same place in Disk>Filesystems tongue

If my changes in fstab won't stay after a reboot, I'll have to look for a new solution sad

Last edited by krackpot (2011-05-30 07:25:32)


DNS-323 (B1) on Alt-F 0.1B7
2x2TB WD20EARS

Offline

 

#5 2011-05-30 18:18:52

jcard
Member
From: Portugal
Registered: 2008-09-21
Posts: 289

Re: Separate Read-only and Write access to the Volumes

krackpot wrote:

I just want a read only of Volume 1 + Volume 2 (say Y: and Z: ), and I don't want to mess with users/permissions. Some of my Windows programs will write metadata or other garbage to the folders and files and Macs will write their cache files in them. So if I make those two partitions read-only, they'll be able to browse, play mp3s etc, but just won't be able to change anything.

But I also want the ability to write to those in a different mapping in windows (say W: and X: ).

I don't think I can set multiple mountpoints to the same place in Disk>Filesystems tongue

If my changes in fstab won't stay after a reboot, I'll have to look for a new solution sad

You can run a disk-resident user supplied and written script at boot. Go to Services->User->user->Configure and in the "Script to execute on powerup" input field enter the full path of a disk-resident executable sh script that you want to run at powerup.

This is the last script executed during boot, and booting stops until it finish, but there should be no problem, as filesystem/RAID checking/mounting/assembling are done asynchronously,  so the script might have to wait until all filesystems are mounted. E.g:

/# cat /mnt/sdb3/myscript.sh:

Code:

 
#!/bin/sh

sleep 30

mount > /mnt/sdb3/myscript.log

produces the following:

/ # cat /mnt/sdb3/myscript.log

Code:

rootfs on / type rootfs (rw)
tmpfs on /rootmnt type tmpfs (rw,relatime)
aufs on / type aufs (rw,relatime,si=4015aaf1)
/dev/loop0 on /rootmnt/rootsq type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime,devgid=9,devmode=664)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime,size=102400k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/sda2 on /mnt/sda2 type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)
/dev/sdb2 on /mnt/sdb2 type ext2 (rw,relatime,errors=continue)
/dev/sdb3 on /mnt/sdb3 type ext2 (rw,relatime,errors=continue)
/dev/sda3 on /mnt/sda3 type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)

FIXME: hmmm, the filesystem where the script is must be mounted at execution time... have to fix this.


Please consider discussing Alt-F at http://groups.google.com/group/alt-f/topics
Please consider filling Alt-F bugs at http://code.google.com/p/alt-f/issues/list

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB