Help! Accidentally Killed permissions

Status
Not open for further replies.

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Hey All,

I just massively screwed up my FreeNAS setup. Everything was working perfectly, my windows machine was able to access my drives on FreeNAS and plex was running beautifully.
Then I tried to get sabnzb working and I made a MASSIVE mistake.

So here's what happened. sabnzb uses media as its default user. I couldn't figure out how to change the user it uses or how to add media to the group I was using for windows.
So my solution was to change the ownership of the folder to media, download the file, then switch it back to my normal user so I could move the files in windows after the fact.
This was working fine, albeit a terrible setup.

Here comes the screw up. Today I go in and decide to download something via sabnzb, so I go into shell and navigate to the main directory which contains my complete and incomplete directory and I type:

chown -R media:media /

As soon as I hit enter I realize my mistake. I forgot to specify a directory. So I run over to the machine and flip the switch. But it is too late and the majority of files have already been switched.

So I panic and then try to reverse what I just did by typing:

chown -R root:wheel /

But now I can't get into any of my files in windows and plex is no longer running correctly (though in the plugins menu it claims to be running)

Looking into the FreeNAS settings I appear to have my windows share set to root:user1, but when I chown to that it doesn't seem to make a difference.

I screwed up real bad I know, is there any way to fix this? Are there logs stored somewhere which keep track of chown changes?

Link to images: https://imgur.com/a/N6hHs
 
Last edited by a moderator:
Joined
Apr 9, 2015
Messages
1,258
You probably will have to start over if you did a chown on /

Sorry to be the bearer of bad news but you changed the permission on EVERYTHING. Resetting your pool will basically be a chown to your user and group for your share and remove the jails completely and start over. And reinstall FreeNAS and import your config... Back it up before you reinstall FreeNAS.

But think of it this way, it's a lesson learned. I can bet you will be more careful next time. And you get to install FreeNAS and set things up again nice and fresh.
 

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Hey nightshade,

Sad day...

Can you explain exactly what I should do?
Reinstalling FreeNAS while a hassle isn't the worst thing in the world, but I don't want to lose any of my stored data.

Will reinstalling FreeNAS kill the storage volume? I'd rather not have to hunt down 6 tb of data again.

I backed up my config, but it was after I made the mistake, so won't that be a useless config?

Thanks a bunch man
 
Last edited by a moderator:
Joined
Apr 9, 2015
Messages
1,258
Nope, won't kill the storage. Just have to import the pool after it's done. https://doc.freenas.org/9.3/freenas_storage.html#import-volume

The worst part of it is fixing the permissions on your data stored on the pool.

The mistake will not invalidate the config. You made a modification on all the systems files but the config while its owner and group will be different than what it may have been if stored on the pool will be unaffected by that change as far as the system's setup and config is concerned.
 
Last edited by a moderator:

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Does it have to be a fresh install or can I do an upgrade?

I just tried an upgrade, seemed to install everything fine. It was super quick. Which seemed odd. But its definitely on my older boot version.
All the old files are still there when I check in shell, so that's good. I should mention I didn't need to do an import. It seemed to do that automatically.

But I can't access the files on the windows machine still. And Plex still doesn't seem to want to start if I go to the ip. (Though plexpy/tautali and freenas itself work).

SMB does not appear to be running.

So I'm assuming I have to do a full reinstall. Correct?

Also how would I go about fixing the pools?
 
Last edited:
Joined
Apr 9, 2015
Messages
1,258
Yep, full install. It likely didn't swap anything out. Basically nuke the drive and set everything back up.
 

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Alright, did a full install.

Reimported the storage. Checking shell files are still there, woo.

Recreated the windows share. But the smb service doesn't seem to want to start.
I assume this has to do with file permissions again.

Looking in shell. Pretty much everything is set to chown of root:wheel now.
Looking in my storage however, it seems to be root:1000

I assume I should change the permissions with the storage "set recursive" button

Ow6OXbo.png


0hhP3ZC.png


abkYYAq.png
 
Last edited:
Joined
Apr 9, 2015
Messages
1,258
Yeah, when you set root wheel on / you changed everything out. You will need to fix those permissions on your shared directory recursively for whomever should own them. If you have a directory that was setup with specific permissions for something like plex you will also have to make those changes again.

You will also have to either create a new directory for or remove and recreate the jails as the permissions there will also be messed up.

Basically it's like setting up the system fresh except your data is still there but owned by someone else.
 

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Hey Night,

Thanks for following up on this again.

I'm not sure what I'm doing wrong here, as everything appears to be set to correct now. But smb refuses to start.

I tried following this guide: https://www.youtube.com/watch?v=RxggaE935PM

Essentially creating a Users group, a user1 user, and a Shared group.
Setting the storage permissions to nobody/shared, and adding user1 to the shared group.

Yet SMB refuses to start. If I attempt to start it from the services menu I get the following exception:

Code:
Request Method: POST
Request URL: http://192.168.1.193/services/cifs/
Software Version: FreeNAS-11.1-U2 (c636d1f4b)
Exception Type: ServiceFailed
Exception Value:
The SMB service failed to reload.
Exception Location: ./freenasUI/services/forms.py in save, line 268
Server time: Sat, 17 Mar 2018 23:25:00 -0700
Traceback

 

Request information
GET
No GET data

POST
Variable Value
__all__ ''
cifs_srv_netbiosname 'freenas'
cifs_srv_netbiosalias ''
cifs_srv_workgroup 'WORKGROUP'
cifs_srv_description 'FreeNAS Server'
cifs_srv_doscharset 'CP437'
cifs_srv_unixcharset 'UTF-8'
cifs_srv_loglevel '1'
cifs_srv_localmaster 'on'
cifs_srv_timeserver 'on'
cifs_srv_guest 'nobody'
cifs_srv_filemask ''
cifs_srv_dirmask ''
cifs_srv_smb_options ''
cifs_srv_unixext 'on'
cifs_srv_zeroconf 'on'
cifs_srv_hostlookup 'on'
cifs_srv_allow_execute_always 'on'
cifs_srv_obey_pam_restrictions 'on'
idmap_tdb_range_low '90000001'
idmap_tdb_range_high '100000000'
__form_id 'dialogForm_'
FILES
No FILES data

COOKIES
Variable Value
csrftoken '********'
sessionid 'goza0jd88irmbbohvsjyi4ni1jo9vx85'
fntreeSaveStateCookie 'root%2Croot%2F133%2F143%2Croot%2F80%2F81%2F82%2Croot%2F80%2F81%2Croot%2F80%2F81%2F82%2F87%2Croot%2F195%2F201%2F203%2Croot%2F195%2F206%2Croot%2F195%2F206%2F208%2Croot%2F195%2F201%2Croot%2F82%2F83%2F84%2Croot%2F82%2F83%2F84%2F89%2Croot%2F192%2Croot%2F49%2F62%2Croot%2F195%2Croot%2F203%2F219%2Croot%2F199%2Croot%2F203%2Croot%2F196%2Croot%2F212%2Croot%2F10%2Croot%2F211%2Croot%2F211%2F217%2Croot%2F211%2F217%2F219%2Croot%2F1%2F6%2Croot%2F82%2Croot%2F82%2F83%2Croot%2F82%2F83%2F84%2F89%2F106%2Croot%2F1%2F8%2Croot%2F203%2F209%2Croot%2F212%2F222%2Croot%2F217%2F227%2F229%2Croot%2F84%2F85%2Croot%2F84%2F85%2F86%2Croot%2F84%2F85%2F86%2F87%2Croot%2F132%2F142%2Croot%2F189%2Croot%2F189%2F195%2Croot%2F189%2F195%2F197%2Croot%2F191%2Croot%2F191%2F197%2Croot%2F122%2Croot%2F122%2F132%2Croot%2F197%2Croot%2F1%2Croot%2F1%2F2%2Croot%2F1%2F7%2Croot%2F81%2F82%2Croot%2F81%2F82%2F83%2Croot%2F81%2F82%2F83%2F84%2Croot%2F81%2F82%2F83%2F88%2Croot%2F150%2F160%2Croot%2F184'
META
Variable Value


Code:

Mar 17 23:24:56 freenas root: /usr/local/etc/rc.d/samba_server: WARNING: failed to start nmbd
Mar 17 23:24:56 freenas root: /usr/local/etc/rc.d/samba_server: WARNING: failed to start smbd
Mar 17 23:24:56 freenas root: /usr/local/etc/rc.d/samba_server: WARNING: failed to start winbindd
Mar 17 23:24:56 freenas kernel: pid 41567 (winbindd), uid 0: exited on signal 6 (core dumped)



9521IyP.png

NOX12Jb.png

BKl9uAw.png

qyQ09uP.png


I also ran the following in the shell:
Code:
 testparm /usr/local/etc/smb4.conf

Load smb config files from /usr/local/etc/smb4.conf																				 
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)														   
Processing section "[Gringotts]"																								   
Loaded services file OK.																										   
Server role: ROLE_STANDALONE																									   
																		   
Press enter to see a dump of your service definitions																			   
																																   
# Global parameters																												 
[global]																														   
	   dos charset = CP437																										 
	   server string = FreeNAS Server																							 
	   lm announce = Yes																										   
	   nsupdate command = /usr/local/bin/samba-nsupdate -g																		 
	   logging = file																											 
	   max log size = 51200																									   
	   kernel change notify = No																								   
	   panic action = /usr/local/libexec/samba/samba-backtrace																	 
	   disable spoolss = Yes																									   
	   load printers = No																										 
	   printcap name = /dev/null																								   
	   time server = Yes																										   
	   map to guest = Bad User																									 
	   obey pam restrictions = Yes																								 
	   security = USER																											 
	   server role = standalone server																							 
	   deadtime = 15																											   
	   hostname lookups = Yes																									 
	   max open files = 940673																									 
	   dns proxy = No																											 
	   idmap config *: range = 90000001-100000000																				 
	   idmap config * : backend = tdb																							 
	   store dos attributes = Yes																								 
	   strict locking = No																										 
	   directory name cache size = 0																							   
	   dos filemode = Yes																										 
	   acl allow execute always = Yes																							 
	   ea support = Yes																										   
	   create mask = 0666																										 
	   directory mask = 0777																									   
																																   
																																   
[Gringotts]																														 
	   path = "/mnt/Gringotts/Gringotts"																						   
	   hide dot files = No																										 
	   veto files = /.snapshot/.windows/.mac/.zfs/																				 
	   guest ok = Yes																											 
	   read only = No																											 
	   vfs objects = zfs_space zfsacl streams_xattr																			   
	   zfsacl:acesort = dontcare																								   
	   nfs4:chown = true																										   
	   nfs4:acedup = merge																										 
	   nfs4:mode = special 


My only thought is maybe the map to guest is causing an issue:

map to guest = Bad User
 
Last edited:
Joined
Apr 9, 2015
Messages
1,258
Not sure what is going on there. I actually use unix permissions on my share since it is mainly me accessing them and I have jails that also access read/write data on the shares so it was easier to just go that route.

The one thing that jumps out at me for some reason is you didn't post a screenshot of the info in the "sharing" section of the SMB share properties. Maybe you are overlooking something?
 

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Oh oops. I must have forgotten to take a screenshot of that.

BlboXw7.png


Maybe I should repost this to the sharing section.
 
Last edited by a moderator:
Joined
Apr 9, 2015
Messages
1,258
It's up to you on re-posting but I wouldn't worry about it.

Right now I am at a loss though, not sure what is happening. I would guess a permission or config issue but I am not seeing it. Maybe @Chris Moore or one of the others might see what I am missing.
 

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
So I have no idea how I fixed it. But I updated to FreeNAS 11-u3 and its working now. SMB started up no problems at all.

Not sure what happened here. But its up woo!.

Thanks a bunch for everything you did Night. I really appreciate it!
 
Last edited by a moderator:

kainthereaper

Dabbler
Joined
Mar 15, 2018
Messages
11
Interestingly enough u4 killed it again.

I downgraded back to u3 and it works again.

I bet I have something wrong with my alc permissions but I have no idea how to fix that correctly. Either way it works on u3 so I'll just keep it on that for the foreseeable future
 
Status
Not open for further replies.
Top