forked from yokoinc/smb-speed-on-mac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmb-speed-on-mac.sh
executable file
·57 lines (39 loc) · 1.6 KB
/
smb-speed-on-mac.sh
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
#!/bin/bash
# Commands that decrease security
# Check if the nsmb.conf file exists and remove it if it does
if [ -f /private/etc/nsmb.conf ]; then
rm /private/etc/nsmb.conf
fi
# Check if the nsmb.conf file exists and remove it if it does
if [ -f /etc/nsmb.conf ]; then
rm /etc/nsmb.conf
fi
# Create a new nsmb.conf file with default section
echo "[default]" >> /etc/nsmb.conf
# Disable SMB signing (decreases security)
echo "signing_required=no" >> /etc/nsmb.conf
# Disable negotiation validation (decreases security)
echo "validate_neg_off=yes" >> /etc/nsmb.conf
# End Section
# Commands with neutral or mixed impact on security
# Enable support for named streams (neutral)
echo "streams=yes" >> /etc/nsmb.conf
# Disable change notifications (neutral, but might affect operational efficiency)
echo "notify_off=yes" >> /etc/nsmb.conf
# Enable soft mounts (neutral, but could impact data availability)
echo "soft=yes" >> /etc/nsmb.conf
# Disable directory caching (neutral, but impacts performance)
echo "dir_cache_max_cnt=0" >> /etc/nsmb.conf
echo "dir_cache_max=0" >> /etc/nsmb.conf
echo "dir_cache_off=yes" >> /etc/nsmb.conf
# End Section
# Commands that improve or do not affect security significantly
# Disable NetBIOS and use direct hosting over TCP/IP (improves security)
echo "port445=no_netbios" >> /etc/nsmb.conf
# Set SMB protocol version to SMB 2 or later (improves security)
echo "protocol_vers_map=4" >> /etc/nsmb.conf
# Enable multi-channel support and prefer wired connections (neutral, typically safe)
echo "mc_on=yes" >> /etc/nsmb.conf
echo "mc_prefer_wired=yes" >> /etc/nsmb.conf
# Exit script
exit