Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1655 Added readonly feature to smbserver.py #63

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/smbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
parser.add_argument('-ip', '--interface-address', action='store', default='0.0.0.0', help='ip address of listening interface')
parser.add_argument('-port', action='store', default='445', help='TCP port for listening incoming connections (default 445)')
parser.add_argument('-smb2support', action='store_true', default=False, help='SMB2 Support (experimental!)')
parser.add_argument('-readonly', action='store_true', default=False, help='Make the share readonly')

if len(sys.argv)==1:
parser.print_help()
Expand All @@ -68,9 +69,14 @@
else:
comment = options.comment

if options.readonly:
readonly = 'yes'
else:
readonly = 'no'

server = smbserver.SimpleSMBServer(listenAddress=options.interface_address, listenPort=int(options.port))

server.addShare(options.shareName.upper(), options.sharePath, comment)
server.addShare(options.shareName.upper(), options.sharePath, comment, readOnly=readonly)
server.setSMB2Support(options.smb2support)

# If a user was specified, let's add it to the credentials for the SMBServer. If no user is specified, anonymous
Expand Down
Loading