Create Temporary Samba Share
Is there a possibility to temporarily share a directory per Samba?
With Python 3 i can serve the current directory per HTTP using:
python -m http.server
.
I'd like to do the same thing with Samba.
samba file-sharing
add a comment |
Is there a possibility to temporarily share a directory per Samba?
With Python 3 i can serve the current directory per HTTP using:
python -m http.server
.
I'd like to do the same thing with Samba.
samba file-sharing
Is thenet share add
command what you're looking for?
– derobert
Nov 13 '12 at 17:14
Or possiblynet usershare
...
– derobert
Nov 13 '12 at 17:15
add a comment |
Is there a possibility to temporarily share a directory per Samba?
With Python 3 i can serve the current directory per HTTP using:
python -m http.server
.
I'd like to do the same thing with Samba.
samba file-sharing
Is there a possibility to temporarily share a directory per Samba?
With Python 3 i can serve the current directory per HTTP using:
python -m http.server
.
I'd like to do the same thing with Samba.
samba file-sharing
samba file-sharing
edited Jul 26 '17 at 9:27
schmijos
asked Nov 12 '12 at 8:41
schmijosschmijos
290411
290411
Is thenet share add
command what you're looking for?
– derobert
Nov 13 '12 at 17:14
Or possiblynet usershare
...
– derobert
Nov 13 '12 at 17:15
add a comment |
Is thenet share add
command what you're looking for?
– derobert
Nov 13 '12 at 17:14
Or possiblynet usershare
...
– derobert
Nov 13 '12 at 17:15
Is the
net share add
command what you're looking for?– derobert
Nov 13 '12 at 17:14
Is the
net share add
command what you're looking for?– derobert
Nov 13 '12 at 17:14
Or possibly
net usershare
...– derobert
Nov 13 '12 at 17:15
Or possibly
net usershare
...– derobert
Nov 13 '12 at 17:15
add a comment |
3 Answers
3
active
oldest
votes
There doesn't appear to be a way to create an ad-hoc share similar to the way exportfs
does it for NFS on Linux and share
does it on Solaris. Reasons may vary but you could technically do something like described in the page for Running Multiple Servers on the same machine and with the custom smb.conf
accomplish what you need to do.
There is also an option to create and delete shares dynamically using SWAT, which will require changes to smb.conf to allow this to happen see sections on add share command
and delete share command
Personally if you want to have a share dynamic you might want to share your home directory and use dynamic home shares via samba discussed in many places including Ubuntu forums, and Samba mailing list.
add a comment |
Depending on how old your samba daemon is, and the config options used when it was built, you may still have the option of defining a "dynamic" share in your smb.conf, pointed at say /var/dynamic/, see below, and then simply adding a symbolic link to the directories you temporarily want to share into the directory.
This hack require the wide links option to be set to yes, to allow samba to follow links outside of the shares root. Unfortunately a couple of years back the Samba crew tweaked their default config to prevent wide shares, as it could be exploited. Google for: Samba and "wide links" for the history and work arounds.
[dynamic]
comment = Somewhere to park dynamic shares
path = /var/dynamic
read only = Yes
inherit acls = Yes
follow symlinks = yes
wide links = yes
A quick test should see if your good e.g.
mkdir -p /var/dynamic/test
cd /var/dynamic
ln -s test a_link
ln -s /tmp/ tmp_test
add a comment |
Lets say you want to quickly share /somefolder to someuser temporary readonly.
Add a system user:
useradd -r someuser
Often by default the folder is other-readable (check with ls -ld /somefolder), if you need to force it:
chmod -R o+r /somefolder
Add the user to samba with some password like:
smbpasswd -a someuser
Quickly edit smb.conf and add at the bottom
[someshare]
path = /somefolder
read list = someuser
exit, save, and finally run
smbcontrol smbd reload-config
et voila.
Obviously you may want to remove the "someshare" section once done and rerun the reload-config command.
Disclaimer: i didnt fully test this but i was amazed how simple the answer to the question could be.
You can possibly skip some steps and dive straight into editing of smb.conf if you already have some user with existing samba access - exactly what i just ran into.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f55488%2fcreate-temporary-samba-share%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
There doesn't appear to be a way to create an ad-hoc share similar to the way exportfs
does it for NFS on Linux and share
does it on Solaris. Reasons may vary but you could technically do something like described in the page for Running Multiple Servers on the same machine and with the custom smb.conf
accomplish what you need to do.
There is also an option to create and delete shares dynamically using SWAT, which will require changes to smb.conf to allow this to happen see sections on add share command
and delete share command
Personally if you want to have a share dynamic you might want to share your home directory and use dynamic home shares via samba discussed in many places including Ubuntu forums, and Samba mailing list.
add a comment |
There doesn't appear to be a way to create an ad-hoc share similar to the way exportfs
does it for NFS on Linux and share
does it on Solaris. Reasons may vary but you could technically do something like described in the page for Running Multiple Servers on the same machine and with the custom smb.conf
accomplish what you need to do.
There is also an option to create and delete shares dynamically using SWAT, which will require changes to smb.conf to allow this to happen see sections on add share command
and delete share command
Personally if you want to have a share dynamic you might want to share your home directory and use dynamic home shares via samba discussed in many places including Ubuntu forums, and Samba mailing list.
add a comment |
There doesn't appear to be a way to create an ad-hoc share similar to the way exportfs
does it for NFS on Linux and share
does it on Solaris. Reasons may vary but you could technically do something like described in the page for Running Multiple Servers on the same machine and with the custom smb.conf
accomplish what you need to do.
There is also an option to create and delete shares dynamically using SWAT, which will require changes to smb.conf to allow this to happen see sections on add share command
and delete share command
Personally if you want to have a share dynamic you might want to share your home directory and use dynamic home shares via samba discussed in many places including Ubuntu forums, and Samba mailing list.
There doesn't appear to be a way to create an ad-hoc share similar to the way exportfs
does it for NFS on Linux and share
does it on Solaris. Reasons may vary but you could technically do something like described in the page for Running Multiple Servers on the same machine and with the custom smb.conf
accomplish what you need to do.
There is also an option to create and delete shares dynamically using SWAT, which will require changes to smb.conf to allow this to happen see sections on add share command
and delete share command
Personally if you want to have a share dynamic you might want to share your home directory and use dynamic home shares via samba discussed in many places including Ubuntu forums, and Samba mailing list.
answered Nov 13 '12 at 16:01
KarlsonKarlson
4,9471943
4,9471943
add a comment |
add a comment |
Depending on how old your samba daemon is, and the config options used when it was built, you may still have the option of defining a "dynamic" share in your smb.conf, pointed at say /var/dynamic/, see below, and then simply adding a symbolic link to the directories you temporarily want to share into the directory.
This hack require the wide links option to be set to yes, to allow samba to follow links outside of the shares root. Unfortunately a couple of years back the Samba crew tweaked their default config to prevent wide shares, as it could be exploited. Google for: Samba and "wide links" for the history and work arounds.
[dynamic]
comment = Somewhere to park dynamic shares
path = /var/dynamic
read only = Yes
inherit acls = Yes
follow symlinks = yes
wide links = yes
A quick test should see if your good e.g.
mkdir -p /var/dynamic/test
cd /var/dynamic
ln -s test a_link
ln -s /tmp/ tmp_test
add a comment |
Depending on how old your samba daemon is, and the config options used when it was built, you may still have the option of defining a "dynamic" share in your smb.conf, pointed at say /var/dynamic/, see below, and then simply adding a symbolic link to the directories you temporarily want to share into the directory.
This hack require the wide links option to be set to yes, to allow samba to follow links outside of the shares root. Unfortunately a couple of years back the Samba crew tweaked their default config to prevent wide shares, as it could be exploited. Google for: Samba and "wide links" for the history and work arounds.
[dynamic]
comment = Somewhere to park dynamic shares
path = /var/dynamic
read only = Yes
inherit acls = Yes
follow symlinks = yes
wide links = yes
A quick test should see if your good e.g.
mkdir -p /var/dynamic/test
cd /var/dynamic
ln -s test a_link
ln -s /tmp/ tmp_test
add a comment |
Depending on how old your samba daemon is, and the config options used when it was built, you may still have the option of defining a "dynamic" share in your smb.conf, pointed at say /var/dynamic/, see below, and then simply adding a symbolic link to the directories you temporarily want to share into the directory.
This hack require the wide links option to be set to yes, to allow samba to follow links outside of the shares root. Unfortunately a couple of years back the Samba crew tweaked their default config to prevent wide shares, as it could be exploited. Google for: Samba and "wide links" for the history and work arounds.
[dynamic]
comment = Somewhere to park dynamic shares
path = /var/dynamic
read only = Yes
inherit acls = Yes
follow symlinks = yes
wide links = yes
A quick test should see if your good e.g.
mkdir -p /var/dynamic/test
cd /var/dynamic
ln -s test a_link
ln -s /tmp/ tmp_test
Depending on how old your samba daemon is, and the config options used when it was built, you may still have the option of defining a "dynamic" share in your smb.conf, pointed at say /var/dynamic/, see below, and then simply adding a symbolic link to the directories you temporarily want to share into the directory.
This hack require the wide links option to be set to yes, to allow samba to follow links outside of the shares root. Unfortunately a couple of years back the Samba crew tweaked their default config to prevent wide shares, as it could be exploited. Google for: Samba and "wide links" for the history and work arounds.
[dynamic]
comment = Somewhere to park dynamic shares
path = /var/dynamic
read only = Yes
inherit acls = Yes
follow symlinks = yes
wide links = yes
A quick test should see if your good e.g.
mkdir -p /var/dynamic/test
cd /var/dynamic
ln -s test a_link
ln -s /tmp/ tmp_test
answered Nov 15 '12 at 18:41
arober11arober11
439137
439137
add a comment |
add a comment |
Lets say you want to quickly share /somefolder to someuser temporary readonly.
Add a system user:
useradd -r someuser
Often by default the folder is other-readable (check with ls -ld /somefolder), if you need to force it:
chmod -R o+r /somefolder
Add the user to samba with some password like:
smbpasswd -a someuser
Quickly edit smb.conf and add at the bottom
[someshare]
path = /somefolder
read list = someuser
exit, save, and finally run
smbcontrol smbd reload-config
et voila.
Obviously you may want to remove the "someshare" section once done and rerun the reload-config command.
Disclaimer: i didnt fully test this but i was amazed how simple the answer to the question could be.
You can possibly skip some steps and dive straight into editing of smb.conf if you already have some user with existing samba access - exactly what i just ran into.
add a comment |
Lets say you want to quickly share /somefolder to someuser temporary readonly.
Add a system user:
useradd -r someuser
Often by default the folder is other-readable (check with ls -ld /somefolder), if you need to force it:
chmod -R o+r /somefolder
Add the user to samba with some password like:
smbpasswd -a someuser
Quickly edit smb.conf and add at the bottom
[someshare]
path = /somefolder
read list = someuser
exit, save, and finally run
smbcontrol smbd reload-config
et voila.
Obviously you may want to remove the "someshare" section once done and rerun the reload-config command.
Disclaimer: i didnt fully test this but i was amazed how simple the answer to the question could be.
You can possibly skip some steps and dive straight into editing of smb.conf if you already have some user with existing samba access - exactly what i just ran into.
add a comment |
Lets say you want to quickly share /somefolder to someuser temporary readonly.
Add a system user:
useradd -r someuser
Often by default the folder is other-readable (check with ls -ld /somefolder), if you need to force it:
chmod -R o+r /somefolder
Add the user to samba with some password like:
smbpasswd -a someuser
Quickly edit smb.conf and add at the bottom
[someshare]
path = /somefolder
read list = someuser
exit, save, and finally run
smbcontrol smbd reload-config
et voila.
Obviously you may want to remove the "someshare" section once done and rerun the reload-config command.
Disclaimer: i didnt fully test this but i was amazed how simple the answer to the question could be.
You can possibly skip some steps and dive straight into editing of smb.conf if you already have some user with existing samba access - exactly what i just ran into.
Lets say you want to quickly share /somefolder to someuser temporary readonly.
Add a system user:
useradd -r someuser
Often by default the folder is other-readable (check with ls -ld /somefolder), if you need to force it:
chmod -R o+r /somefolder
Add the user to samba with some password like:
smbpasswd -a someuser
Quickly edit smb.conf and add at the bottom
[someshare]
path = /somefolder
read list = someuser
exit, save, and finally run
smbcontrol smbd reload-config
et voila.
Obviously you may want to remove the "someshare" section once done and rerun the reload-config command.
Disclaimer: i didnt fully test this but i was amazed how simple the answer to the question could be.
You can possibly skip some steps and dive straight into editing of smb.conf if you already have some user with existing samba access - exactly what i just ran into.
answered Feb 28 at 22:08
DaaNMaGeDDoNDaaNMaGeDDoN
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f55488%2fcreate-temporary-samba-share%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is the
net share add
command what you're looking for?– derobert
Nov 13 '12 at 17:14
Or possibly
net usershare
...– derobert
Nov 13 '12 at 17:15