-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfs.html
1076 lines (758 loc) · 34.1 KB
/
fs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="psg.css" type="text/css">
<LINK REL="SHORTCUT ICON" HREF="favicon.ico" type="image/x-icon"/>
<META NAME="description" content="System Administrator Pocket Survival Guide - A series of notes for Sys Admin"/>
<META NAME="keyword" content="Sys Admin, System Administrator, Solaris, HP-UX, AIX, Linux, Note, Notes, Pocket, Survival, Guide, psg, data center, power, electrical, plug, LYS, LKS, LAPPLAPP"/>
<META NAME="Robots" CONTENT="all"/>
<META NAME="Author" CONTENT="Tin Ho"/>
<!-- Global site tag (gtag.js) - Google Analytics 2019.02 tin6150@g -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-40858809-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-40858809-1');
</script>
<title>Pocket Survival Guide - FS</title>
</head>
<body>
<div class="navheader">
<table summary="Navigation header" width="100%">
<tbody>
<tr>
<th colspan="9" align="center">
<A HREF="http://tin6150.github.io/psg/fs.html">Sys Admin Pocket Survival Guide - FS</A>
</th>
</tr>
<tr>
<td align="left"> <a accesskey="h" href="psg.html">Home</a> </td>
<td align="center"><a accesskey="i" href="isilon.html">Isilon</a></td>
<td align="center"><a accesskey="n" href="netapp.html">NetApp</a> </td>
<td align="center"><a accesskey="e" href="emc.html">EMC</a> </td>
<td align="center"><a accesskey="n" href="emcCelerra.html">EMC(NAS)</a></td>
<td align="right"> <a accesskey="l" href="linux.html">Linux</a> </td>
<td align="right"> <a accesskey="d" href="ldap.html">LDAP</a> </td>
</tr>
</tbody>
</table>
<hr></div>
<div class="chapter" lang="en">
<div class="titlepage">
</div>
</div>
xref: <BR>
<A HREF="netapp.html">Netapp</A> <BR>
<A HREF="isilon.html">Isilon</A> <BR>
<A HREF="#synology">Synology</A> (see below) <BR>
<BR>
<H1>Files, ACL, security</H1>
- ext4 ? <BR>
- xfs ? <BR>
<H4>setfacl/getfacl</H4>
<PRE>
getfacl file1 # read permissions
setfacl -m u:andy:rw file1 # -m = modify: give (a secondary user) named andy read/write access to file1
setfacl -m g:admin:rw file1 # g for secondary group, here a group named admin, get rw access
setfacl -x u:andy file1 # -x = remove permissions
directory can have default acl set so that all files within it will inherit such acl automatically. use "d" to specify it as default settings. eg
:
setfacl -m d:g:admin:rw dir1
</PRE>
<H4>attributes</H4>
So, not only DOS has attributes for files! Linux does too! It is another layer over what chmod provides!
These attributes are supported starting from ext2.
<PRE>
getattr /path/to/file # list file attributes
chattr =i /path/to/file # change, ie set, file attributes to immutable
sudo chattr -i /path/to/file # only CAP_LINUX_IMMUTABLE user can remove the immutable flag!
select the new attributes for the files:
append only (a),
compressed (c),
no dump (d),
extent format (e),
immutable (i),
data journalling (j),
secure deletion (s),
no tail-merging (t),
undeletable (u),
no atime updates (A),
synchronous directory updates (D),
synchronous updates (S),
top of directory hierarchy (T).
The following attributes are read-only, and may be listed by lsattr(1) but not modified by chattr:
huge file (h),
compression error (E),
indexed directory (I),
compression raw access (X),
compressed dirty file (Z).
</PRE>
<BR><BR>
<H1>compatibility</H1>
<PRE>
FS on portable drives, eg thumbdrive
or OS install, the mess of UEFI...
parition type mkfs linux win10 mac notes
--------------- --------- ------- ------ ------ --------------------
c: fat32 (LBA) -t vfat yes yes yes max file size 4GB
ef: EFI FAT-12
7: exFAT -t exfat no yes ?
7: NTFS
7: HPFS
BIOSboot partition needed in BIOS mode boot for system with UEFI?
bios... /boot [debian use xfs]
efi... /boot/efi strictly FAT here
</PRE>
<H1>SystemD, NetworkManager</H1>
SystemD has a ProtectHome clause, which NetworkManager set to read-only. <BR>
This results in /home cannot be renamed or deleted, as it will result in
"Device or resource busy" <BR>
lsof, fuser don't report any process actually hogging /home?
<PRE>
grep -r ProtectHome /usr/lib/systemd
/usr/lib/systemd/system/chronyd.service:ProtectHome=yes
/usr/lib/systemd/system/NetworkManager.service:ProtectHome=read-only
</PRE>
also see ProtectSystem=true <BR>
ref: https://centosfaq.org/centos/cant-delete-or-move-home-on-73-install/
<H1>FS</H1>
<!--fs.ref-->
<PRE>
# cmd.mount.ref
# this file will contain all commands in relation to filesystem manipulations.
# eg mount, fsck, etc.
# some originally from cmd.admin.ref
# need to do some clean up and splitting...
amq show currently automounted drv (from amd suit)
mount show mouted partitions (root mount new ones too)
showmount
mount -t nfs server:/path /mnt/point #linux
mount -F nfs server:/path /mnt/point #solaris
mount -o remount,suid /mnt/point # "remount" a fs, so as to set new mount options
# should be able to remount ro fs as rw
/etc/fstab
/etc/vfstab
/etc/dfs/dfstab Solaris, eg:
share -F nfs -o ro -d "tin-sun /mnt/cdrom" /mnt/cdrom
share -F nfs -o ro -d "tin-sun vold /cdrom" /cdrom/cdrom0
#share -F nfs -o ro -d "tin-sun vold /cdrom" /cdrom/sol_10_305_sparc # don't work for OS cd
share -F nfs -o ro -d "tin-sun vold /cdrom s0" /cdrom/sol_10_305_sparc/s0 # need to export each slide separately
share -F nfs -o ro -d "tin-sun vold /cdrom s1" /cdrom/sol_10_305_sparc/s1 # as they are mounted separately.
solaris :
mount -F {fstype> servername:/exportName /mount/point
{fstype> in solaris
nfs
cdrom : hsfs /dev/rdsk/c0t6d0s0 /cdrom
dos : pcfs
If not using vold to manage cdrom, add entry like this to the vfstab:
/dev/dsk/c0t6d0s0 - /mnt/cdrom hsfs - no -
showmount -e {hostname> : display the devices shared by a remote host that can be mounted
showmount -a : list remote system that has mounted a export
solaris loopback fs, sample entry in vfstab, as per man page on mount:
/export/test - /opt/test lofs - yes -
removable media management - vold
/etc/init.d/volmgt start|stop
in sol up to 9, vold is very buggy, and tend to cause problem,
especially after hitting eject button on cdrom drive w/o using soft "eject cdrom"
if it goes bad, stop,start don't seems to help. need reboot.
in sol 10, seems to be better, at least volmgt stop,start clear things up.
usb devices:
sol 10 handles usb dev mounting pretty good.
mounting them correctly and showing icon on desktop.
Files can be access in /rmdisk/...
- usb floppy drive from apple
- usb cd/dvd/burner from iomega
- usb memory storage (lexar jumpdrive)
usb devices are hot plug detected by kernel since solaris (8?).
usb hard drive should work since solaris 8.
see gmail ref for more info.
/dev/usb/... is driver, and sym link created into /dev/[r]dsk/
though somehow format did not see the disk.
see
http://docs.sun.com/app/docs/doc/817-5093/6mkisopve?a=view
other vold paths:
/vol/... (/vol/dev/[r]dsk, /vol/dsk, ...)
some maybe used as raw path for floppy dd when vold is running.
********************************************************************************
linux :
********************************************************************************
mount -t vfat -o loop=/dev/loop0 /tmp/floppy.dd.img /mnt/loopbackmount
: use loopback to mount a dd-ed image of a dos floppy, fully writable.
mount -t iso9660 -o loop,ro /tmp/cdrom.dd.img /mnt/loopbackmount
: same as above, mounting imaged created from cdrom
# NFS export cannot see loopback devices (at least in linux, solaris)
# and loopback from a file based off NFS won't work either
# Typically, supports only 8 loopback "devices" unless edit loop.c and recompile kernel
dd if=/dev/cdrom of=/tmp/cdrom.dd.img : create dd image out of cdrom, using raw dev.
smb.conf
smbmount
smbmount -V
mount -t smbfs -o username=tin,password=foobar //n2k/c$ /mnt/n2k/c$ (trying in rh7.1 jaba)
mount -t smbfs -o 'username=administrator,password=bar,workgroup=ntdom2' //10.0.71.231/cifs /mnt/smbfs
umount
fuser <dir> : which user holding up what file, useful when mounting, etc
fuser -cu : -cu show user and resolved user name using a particular mount point
mount -t <fstype> ...
cdrom is iso9660
vfat
ext2
ntfs
Making ext2 floppy
fdisk /dev/fd0
create primarty partition of type Linux (ext2)
mke2fs /dev/fd0
mount -t ext2 /dev/fd0 /mnt/floppy
or mount /mnt/floppy (auto determine fs type should work).
linux sample /etc/fstab:
# {file system} {mount point} {type} {options} {dump} {pass}
/dev/hda1 / ext2 defaults 1 1
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/hda6 /var ext2 defaults 1 2
/dev/hda7 /work ext2 defaults 1 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hda5 swap swap defaults 0 0
#
# external mounts
#
//10.0.1.245/c$ /mnt/tin-nt/c$ smbfs noauto,username=tin 0 0
192.168.71.30:/ /mnt/test nfs noauto 1 1
#/tmp/diag.floppy.dd /mnt/loopbackmount vfat user,exec,noauto,loop=/dev/loop0
/tmp/diag.ext2.dd /mnt/loopbackmount ext2 user,exec,noauto,loop=/dev/loop0,ro
/img/rhel-3-cd1.iso /mnt/rhel-3-cd1 iso9660 loop,ro # cd iso img from rhn ftp
#
# mount option user will default to noexec
# sometime loopback mount will complain with strange message if image is not on a local fs
#
linux sample /etc/exports:
# Either use
# (1) space delimit multiple machines of the same export dir
# each machine options must be given immediately,
# colon (or comma) CANNOT be used to group multiple machines with same option as in Solaris
# (2) each machine has its own line, with mount point repeated.
# Then run exportfs -a to export everything
#
# (eg 1)
/mnt/usbdrv tin-sun(rw,no_root_squash,async) chong-sun(rw,no_root_squash,async)
# (eg 2)
/export tin-sun(rw,no_root_squash,sync)
/export chong-sun(rw,no_root_squash,sync)
/export2 *.sn50.com(ro,async)
/export2 172.27.0.0/16(ro,async)
# be very careful about NOT to have a space after hostname.
# tin-sun (rw)
# would mean tin-sun has default option
# and all hosts (*) would have (rw) !!
# other export options
# https://serverfault.com/questions/539267/nfs-share-with-root-for-anonuid-anongid
# eg
# all_squash means everyone will get remapped, in this case to UID=0, GID=0. but could be mapped to other UID...
/STORAGE 10.0.5.10(rw,sync,no_subtree_check,all_squash,anonuid=0,anongid=0)
### smb.conf and related stuff
security = domain,
then use
smbpasswd -j ntdom1 -r '10.0.72.15' -UAdministrator%password
USB hard drive on linux.
Hot plug ok.
Tested on RH AS 3.0 (ges-dfm).
Typically made available as /dev/sda1.
</PRE>
<A ID="cifs"></A>
<H2>CIFS</H2>
<!--cifs.ref-->
<PRE>
http://www.codefx.com/CIFS_Explained.htm
doc found by peter, fwd by emily about basic of cifs file operation.
cifs common internet file system
used by windows, and also has stuff like network browsing,
print services, authentication (NT). aka smb
Commonly a layer 7/6 (app/presentation) protocol, and usually
run over NTB.
smb server message block
samba unix open source implementation of some of cifs.
NetBIOS
NTB NetBIOS over TCP
NetBEUI NetBIOS Enhanced User Interface (NetBios + precursor of CIFS)
SNIA Storage Network Industry Association
Coming up with CIFS 1.0 protocol w/ IETF.
Subset of current M$ CIFS, try to document it better,
and maintain for future.
WINS M$ refer this as the NetBIOS name server implementation.
Same function of DNS, but implemented totally differently.
Use lot of broadcast!
Run over NetBIOS (on top of whatever network protocol).
</PRE>
<H4>Linux fstab eg</H4>
<PRE>
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/emcpowerc /mnt/emcpowerc ext3 defaults 0 0
nfsserver:/unixhome /nfshome nfs rw,soft,intr,tcp,rsize=32768,wsize=32768,vers=3,timeo=4,retrans=9 0 0 # cambridge eg
nfsserver:/unixhome /nfshome nfs bg,rw,hard,intr,udp,rsize=32768,wsize=32768,vers=3,timeo=4,retrans=9 0 0
agami01:/export/agami /nfsbackup/agami nfs rw,nfsvers=3,rsize=32768,wsize=32768,tcp,intr,soft # RHEL 4.5
/net/pollo/local/LINUX/SUSE/SUSE-10.0-CD-i386-GM-CD1.iso /mnt/loopback/SUSE-10.0-CD-i386-GM-CD1 iso9660 loop,ro,noauto
/export/repo/iso/RHEL4-U5-i386-WS-disc1.iso /mnt/loopback/RHEL4-U5-i386-WS-disc1 iso9660 loop,ro,noauto
## mount ordering number at the end doesn't seems to matter anymore
## systemd for ordering sequence of mounts
## ref: https://github.com/systemd/systemd/commit/3519d230c8bafe834b2dac26ace49fcfba139823
ml4hep1:/global/home/users /global/home/users nfs rw,bg,soft,intr,_netdev 0 1
/global/home/users /home none _netdev,bind,-systemd.requires-mounts-for=/global/home/users 0 2
</PRE>
<H5>options per mounts </H5>
<PRE>
# Next one works for NFSv3, not v4, can't specify mountport and mountproto. much of v4 no longer use the rpc aux protocol stuff:
rw,bg,hard,intr,_netdev,nosuid,vers=3,mountport=635,mountproto=tcp,local_lock=none,lock,clientaddr=10.229.192.134
# NFSv4 mount options
rw,bg,hard,intr,_netdev,nosuid,vers=4,local_lock=none,lock
vasttest.greta.local:/greta on /global/userspace type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.8.16.51,mountvers=3,mountport=20048,mountproto=udp,local_lock=none,addr=10.8.16.51,_netdev)
NFSoRDMA
both client and server need to support it.
Need NIC with RDMA support, eg Mellanox ConnectX-3. Work in Ethernet mode, check on RoCEv2
ref: http://www.unstructureddatatips.com/how-to-configure-nfs-over-rdma/
https://infohub.delltechnologies.com/l/powerscale-onefs-nfs-over-rdma-for-media/what-is-nfs-over-rdma-1
mount -t nfs -vo nfsvers=3,proto=rdma,port=20049 172.16.200.29:/ifs/export_rdma /mnt/export_rdma
nfsclient kernel: lockd: server nfsserer not responding, still trying
nfsclient kernel: xs_tcp_setup_socket: connect returned unhandled error -107
turn off nfs lock... or configure firewall to let lockd ? to work
/etc/nfs.conf
/etc/modprobe.d/lockd.conf
nfs ports
111 (TCP, UDP) server
2049 (TCP, UDP) server
20048 nfs mount
20049 nfsrdma
portmapper rpcinfo -p # -p w/o host is for local host portmapper
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100024 1 udp 35703 status
100024 1 tcp 46391 status
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
100021 1 udp 35141 nlockmgr
100021 3 udp 35141 nlockmgr
100021 4 udp 35141 nlockmgr
100021 1 tcp 39794 nlockmgr
100021 3 tcp 39794 nlockmgr
100021 4 tcp 39794 nlockmgr
-A INPUT -s 128.3.7.196 -p tcp -m multiport --dports 111,2049,20048,35141,35141834,835,836,837 -j ACCEPT -m comment --comment "RPC and NFS"
# query against remote host, eg netapp filer
rpcinfo -p NFS_SERVER
program vers proto port service
100011 1 udp 4049 rquotad
100024 1 tcp 4047 status
100024 1 udp 4047 status
100021 4 tcp 4045 nlockmgr
100021 3 tcp 4045 nlockmgr
100021 1 tcp 4045 nlockmgr
100021 4 udp 4045 nlockmgr
100021 3 udp 4045 nlockmgr
100021 1 udp 4045 nlockmgr
100005 3 tcp 4046 mountd
100003 3 tcp 2049 nfs
100005 2 tcp 4046 mountd
100005 1 tcp 4046 mountd
100003 2 tcp 2049 nfs
100005 3 udp 4046 mountd
100003 3 udp 2049 nfs
100005 2 udp 4046 mountd
100005 1 udp 4046 mountd
100003 2 udp 2049 nfs
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
</PRE>
<H4>Solaris vfstab eg</H4>
<PRE>
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no logging
/dev/md/dsk/d20 - - swap - no logging
swap - /tmp tmpfs - yes -
##
##
nfsserver:/unixhome - /nfshome nfs 2 yes rw,vers=3,rsize=32768,wsize=32768,proto=tcp,intr,soft
</PRE>
<A NAME="NFSv4"></A>
<A NAME="nfsv4"></A>
<A NAME="v4"></A>
<H1>NFSv4</H1>
Features:
<LI> Sync write persistence
<LI> Distributed file locking
<LI>
<PRE>
* Stateful (!) personality
- Not same kind of statefulness as CIFS
- session is at app layer, not TCP layer.
- locks state are in controller memory, not persistent. Client can re-check on lock and ensure no disruption during HA event.
* UDP no longer supported
* GSS-API: Generic Security Services API (RPCSEC_GSS)
- Kerberos
- LIPPKEY - Low Infrastructure Public Key Mechanism
- Simple PUblic Key Mechanism (SPKM-3)
* Kerberos 5
- Symetric key
- Encrypted tickets and sesions keys from KDC
- Unix use MIT
- Windows use 2008R2 AD
- Support for Kerberos attribute is REQUIRED on client and server,
but run time can opt to leave this blank;
whence Kerberos is not a must to have NFSv4 client talkign to NFSv4 server.
* ACL is much closer and interoperable with CIFS
- based on NTFS model
- array of ACE (Access Control Entries)
- support allowed and denied permissions, flags
- UID/GID are string based (eg user@domain) instead of 32-bit integers used in NFSv3. (!!)
+ vserver nfs show -vserver nas1 -fields v4-numeric-ids :
make netapp respond with numeric UID for client that cannot understand string,
this would generally make things easier (eg for transition period) [TR-4072 page 46]
- NFSv4 ACL, no support for POSIX ACL (migration from 3rd party must manually set NFSv4 ACL)
- nfs4_setfacl -e
nfs4_getfacl /home/als/physbase/hlc/General/
nfs4_editfacl
nfs4_setfacl
* At least on netapp OnTap 9.x
- traditional bits permisisons seems to be kept in parallel to NFSv4 ACL on the file object
- chmod in NFSv3 by default will change NFSv4 ACL, unless such trigger is set not to happen
* Pseudo FS (in dedicated namespace)
- entry point at /
- junction path
* Client need /etc/idmapd.conf
- if not set, use `domainname`
</PRE>
<H2>NFSv4 ref</H4>
<UL>
<LI> <A HREF="https://www.netapp.com/us/media/tr-4067.pdf">TR-4067: Clustered Data ONTAP NFS Implementation and Best Practice Guide</A>(2017.07). Page 81 discuss about NFSv4.1 and numeric id (instead of default string-based id)
[<A HREF="3rdParty/OnTap-tr-4067.pdf">cache</A>]
<LI><A HREF="https://www.netapp.com/us/media/tr-4073.pdf">TR-4073</A> (2017) - NFSv4.x LDAP, etc security mappings.
<LI><A HREF="https://www.netapp.com/us/media/tr-3580.pdf">TR-3580: NetApp NFSv4 Best Practices Guide</A>(2016.02)
[<A HREF="3rdParty/OnTap-tr-3580.pdf">cache</A>] - covers more details and background of NFSv3 vs NFSv4, ACL, etc.
<LI>
<LI><A HREF="https://help.ubuntu.com/community/NFSv4Howto">https://help.ubuntu.com/community/NFSv4Howto</A>:
<UL>
<LI>Can operate without a Domain/Kerberos server. set NEED_SVCGSSD=no, and NFSv4 can rely on client side authentication as in NFSv3, albeit this isn't all that secure.
<LI>Use with Kerberos (MIT or Heimdal) + KDC (Key Distribution Center) provides much better security.
</UL>
<LI>
<LI>NFS exports works differently. On the server side, it has a root export where everything else falls under.
<LI>Typically default to proto=tcp,port=2049
<LI>/etc/idmapd.cfg, nfsidmap, map user with different UID b/w NFSv4 server and client.
<LI>
<LI><A HREF="http://www.enterprisenetworkingplanet.com/netos/article.php/3644471/Implement-NFSv4-Domains-and-Authentication.htm">http://www.enterprisenetworkingplanet.com/netos/article.php/3644471/Implement-NFSv4-Domains-and-Authentication.htm</A> (from 2006!):
<UL>
<LI>NFSv4 introduce concept of Domain. Many would rely on DNS domain for client and server to match. Solaris allow for setting an explicit NFS domain.
<LI>In addition to UID/GID needing to batch b/w client and server, Domain must match as well.
<LI>Could use DNS RR or TXT record to specify domain.
</UL>
<LI><A HREF="http://nfsworld.blogspot.com/2005/06/using-active-directory-as-your-kdc-for.html">Eisler's NFS blog</A> describe how to use Active Directory with NFSv4. From 2005! Long solved problem, how many use it?
</UL>
<A ID="samba"></A>
<A ID="smb"></A>
<H1>Samba</H1>
samba 3 uses NT domain logins to serve account information, and <BR>
samba 4 is compatible with active directory. <BR>
<BR>
samba 2 use smbpasswd. samba 3 use pdbedit (and no more smbpasswd?) <BR>
<!--smb.ref-->
<PRE>
samba 2.x
smbpasswd -j <NTDOM> -r <WinsSvr or '*'> -Uuser%password
run winbindd
then start samba.
getent
nmblookup -U <winsSvrIp> -R <NbNameToLookup>
---
samba 3.0 use the "net" command:
net [method] [-d dbgLevelNum] join member -Uadministrator%password -S tileg-bdc1
member = add host as member host (not as pdc/bdc)
-S = target (window) server to use
[method] can be blank, it will auto detect
ads = XP style
rpc = nt4 style
ads = win95 style ?
-d 0-10 specify debug level info (spill to console), 0=none, 5=a lot, 10=unreadable. Try 3.
net testjoin
check whether domain participation is still valid
# no longer avail???
net help <CMD>
show help
---
strace -o /tmp/output smbpasswd ...
to see what file it opens, has tendendy to open wrong smb.conf
wbinfo -u
list all doamin user
bin/testparm lib/smb.conf
check that smb.conf is correct.
smbclient //10.0.71.231/cifs -W ntdom1 -Uadministrator%password
ftp like client to connect to nt-style share
smbclient -L 10.0.71.231 -N
list shares available from the given server
-N = force no ask password
----
update 2004/06/23, for samba 3.0, in tileg/hybridauto
config procedure
create /usr/local/samba/lib/smb.conf file (see eg here for core elements).
bin/testparm lib/smb.conf
add member host in PDC via server manager.
net join -Uadmin -S PDC-server # for security=server
sbin/nmbd
sbin/smbd -D -s lib/smb.conf
# parameters are really default, but just in case samba have its own mind.
sbin/smbd --version
# show version
If using security=user, then may need to use smbpasswd -a to add user
Although it seems to authenticate via NIS if no smbpasswd entry.
---
2005/12/02
quick and dirty config w/o domain fuss,
in smb.conf, set to use user level security mode (ie local list of samba user) :
security = user
add users to smbpasswd file as (user must be recognized os level user):
smbpasswd -a USERNAME
change existing user password:
smbpasswd USERNAME
Samba 3 use pdbedit.
pdbedit -L -v # list samba users, verbose
# samba local db stored in /var/lib/samba/private/private.tdb
---
logs:
location specified by smb.conf, typically /usr/local/samba/var
log.IP = NetBIOS ip to name resolution log, per each client machine connecting to the server.
log.HOSTNAME = smbd log for each connecting client after netbios name resolution.
log.nmbd = nmbd server process/status log
log.smbd = smbd server process/status log. level determined by smb.conf
</PRE>
<A ID="smb.conf"></A>
<H3>smb.conf</H3>
<!--smb.conf-->
<PRE class="cf">
[global]
; Wcry-like exploit
; security fix as per http://thehackernews.com/2017/05/samba-rce-exploit.html?m=1
nt pipe support = no
# log level = 3 passdb:5 auth:10 winbind:2
# log level = 0 (default)
log level = 2
# workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4
workgroup = TILEG # NT4
# Security mode. Defines in which mode Samba will operate. Possible
# values are share, user, server, domain and ads. Most people will want
# user level security. See the HOWTO Collection for details.
#security = user # user = local passwd/smbpasswd file
security = server # need to join machine to nt domain
#security = domain # probably never used this.
# whether to use encrypted password
#encrypt passwords = yes # default = yes
#encrypt passwords = no
load printers = yes
log file = /usr/local/samba/var/log.%m
password server = tileg-bdc1
# this was needed as somehow my machine could not determin
# who was PDC, probably no broadcast on this vlan.
wins support = no
wins server = 10.215.2.21
# set it so that samba is not wins server,
# and have it use wins on BRIO-BDC1
# otherwise, lot of browse by \\hostname will get bad
# unresolvable hostname :(
socket options = TCP_NODELAY
dns proxy = no
#============================ Share Definitions ==============================
### custom settings here
[test]
comment = test dir
browsable = yes
read only = no
create mode = 755
path = /export/tmp/test
user = tho
#============================ Share Definitions ==============================
### this and other were smb.conf.default settings.
[homes]
comment = Home Directories
browseable = no
writable = yes
</PRE>
<A ID="username_mapping"></A>
<H2>username mapping</H2>
in smb.conf, there is a clause like
<PRE class=cf>
username map = /etc/samba/smbusers
</PRE>
which by default is
<PRE class=cf>
root=administrator admin
nobody=guest pcguest smbg
</PRE>
This file can be updated to map user whose login name differ between unix and windows.
<A ID="sid2uid"></A>
<A ID="uid2sid"></A>
<H2>SID to UID/GID mapping</H2>
the ID numbers is what the computer use.
winbind has to provide unix UID/GID numbers. If a username is not resolvable to unix UID number, it will generate a number and use it.
The number generated is in a range defined in smb.conf.
This number is stored in "idmap" and there is a "net idmap" command to do dump and restore (edit is by hand edit this file and reimport?).
<BR>
pdbedit is the samba user database. User of samba need to have account added here.
The UID number assigned here may differ from what winbind (wbinfo) may return.
OS calls such as getent and id would honor the UID# assigned in pdbedit (when winbind is used in nsswitch.conf).
<BR>
Not sure what order of precedence wbinfo works on.
It does "do the right thing" in that id would look at places where one can manipulate UID# using pdbedit (?)
<BR>
<!-- ~/NOTE/samba.rst -->
<PRE>
pdbedit — manage the SAM database (Database of Samba Users)
pdbedit entry can overwrite UID# winbindd returns
getent passwd USERNAME will return UID# specified in pdbedit (nsswitch.conf passwd use "files winbind")
pdbedit -L -w -d0 # -L = list all entries (ie a dump).
# -w = smbpasswd format
# -d0= debug level 0 (may still get warning messages in output)
pdbedit --modify
pdbedit -a sn # add user sn. user must exist as unix (passwd) or windows (AD) user.
pdbedit -x -u sn # deleting a user that has a uid randomly assigned
# and readding it after it exist in passwd
# may set it to have the right UID#
wbinfo # query winbind for info
wbinfo -u | wc # list all --domain-users
wbinfo -n ateran # --name-to-sid
wbinfo --user-sidinfo SID # return passwd-like string with UID# for a given SID
wbinfo -S S-1-5-21-1224182940-43089146-691797619-2275 # --sid-to-uid eg: 781
wbinfo -s S-1-5-21-1224182940-43089146-691797619-4805 # --sid-to-name
wbinfo --sid-to-fullname SID # conver to DOMAIN\username
wbinfo --user-sids SID # list group SID a given SID belongs to
wbinfo --user-domgroups SID # list domaingroup a given SID belongs to
wbinfo --sid-aliases S-1-5-21-1224182940-43089146-691797619-2275 # sid has aliases!!
wbinfo -i bofh # login to uid#
wbinfo -r bofh # get unix secondary gid for named user
wbinfo --uid-info 781 # return passwd-like string for given uid#
</PRE>
ref:
<A HREF="https://www.samba.org/samba/docs/man/manpages-3/wbinfo.1.html">
samba doc on wbinfo</A>
<A ID="winbind"></A>
<H2>winbind</H2>
winbindd perform SID to UID# mapping.
info stored in a db.
<BR>
ref:
<A HREF="https://www.samba.org/samba/docs/man/manpages-3/winbindd.8.html">
NAME AND ID RESOLUTION section of winbindd samba doc</A>
<BR>
UID# are often generated for user w/o unix passwd entry. Thus, if have multiple machine running winbindd, would be good to
setup cronjob to keep the winbid db in sync (idmap)
<BR>
<PRE>
net cache flush
</PRE>
idmap does mapping between SID and UID#/GID#.
When the file is dumped, it can be (carefully) edited and (re)-imported (by different hosts).
<BR>
<PRE>
# syncing IDs between different winbind machines
net idmap dump /var/lib/samba/winbindd_idmap.tdb > dumpfile.txt
net idmap restore /var/lib/samba/winbindd_idmap.tdb < dumpfile.txt
net idmap dump winbindd_idmap.tdb > /dev/null 2>&1 | ssh slave.samba.net 'net idmap restore' > /dev/null 2>&1
</PRE>
ref:
<A HREF="http://web.mit.edu/samba/swat/help/Samba3-HOWTO/NetCommand.html">
Samba3 :: Chapter 12. Remote and Local Management: The Net Command</A> :: Managing IDMAP UID/SID Mappings (at the end)
<PRE>
wbinfo -m # list --trusted-domains
wbinfo --own-domain # what domain this smb server is on
wbinfo -p # --ping winbindd to ensure connection still good
wbinfo -P # --ping-dc to ensure connection still good
wbinfo -t # --check-secret of workstation to AD still good
# ie determine if secret used to join ntdomain is still good (security=server)
</PRE>
<A ID="net_cmd"></A>
<H2>net cmd</H2>
<PRE>
To interact with AD, the DOS net commands are available.
net rpc info
the net idmap command operates locally and is covered in the UID to SID mapping section above
</PRE>
<BR><HR><BR>
<BR>
See also: <BR>
<A HREF="netapp.html">Netapp</A> <BR>
<A HREF="isilon.html">Isilon</A> <BR>
<BR><BR>