Unmounting SMB share folder

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I mounted a SMB share folder under /mnt/smb/ and I can access the files. When I unmount this shared folder using command:



umount /mnt/smb/


naturally I cannot list shared folder contents using command:



ls /mnt/smb/


But the problem is when I run the ls command from a PHP file on the same machine, the contents of shared SMB folder can be listed! The contents of PHP file is:



<?php
$command = 'ls /mnt/smb/';
$result = shell_exec($command);
echo $result;
?>


What is my mistake. Is there any other commanf needed for completely unmount the SMB share? I also used command below but there was no luck:



fusermount -u /mnt/smb/






share|improve this question




















  • Please also post the output of mount | grep /mnt/smb after umounting (when ls from the shell does not work), then also check whether the command gives the same result (hopefully, an empty line) after accessing from php. If there is a difference maybe the share is auto-mounted again. NB: If the output of the mount command contains a username or password, I suggest you remove it before posting.
    – Ned64
    Feb 17 at 9:45











  • The output is: //172.16.50.207/SoftBank on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=teknik,domain=OFIS-NAS,uid=0,noforceuid,gid=0,noforcegid,addr=172.16.50.207,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
    – Hamid Reza
    Feb 17 at 12:16










  • If that it the output after umounting then the drive has NOT been umounted in the first place! ls /mnt/smb/ should work (at least as root!). Oh, and please move the output into your question so that it can be formatted correctly.
    – Ned64
    Feb 17 at 12:27











  • Sorry, my wrong. The output of mount | grep /mnt/smb after UMOUNT is empty line. My previous comment was output after MOUNT.
    – Hamid Reza
    Feb 17 at 12:55










  • Very good. Now, after the empty line, (a) can you list the files by php?, and (b) if you can, then please test the mount command again and let us know.
    – Ned64
    Feb 17 at 12:58














up vote
1
down vote

favorite












I mounted a SMB share folder under /mnt/smb/ and I can access the files. When I unmount this shared folder using command:



umount /mnt/smb/


naturally I cannot list shared folder contents using command:



ls /mnt/smb/


But the problem is when I run the ls command from a PHP file on the same machine, the contents of shared SMB folder can be listed! The contents of PHP file is:



<?php
$command = 'ls /mnt/smb/';
$result = shell_exec($command);
echo $result;
?>


What is my mistake. Is there any other commanf needed for completely unmount the SMB share? I also used command below but there was no luck:



fusermount -u /mnt/smb/






share|improve this question




















  • Please also post the output of mount | grep /mnt/smb after umounting (when ls from the shell does not work), then also check whether the command gives the same result (hopefully, an empty line) after accessing from php. If there is a difference maybe the share is auto-mounted again. NB: If the output of the mount command contains a username or password, I suggest you remove it before posting.
    – Ned64
    Feb 17 at 9:45











  • The output is: //172.16.50.207/SoftBank on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=teknik,domain=OFIS-NAS,uid=0,noforceuid,gid=0,noforcegid,addr=172.16.50.207,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
    – Hamid Reza
    Feb 17 at 12:16










  • If that it the output after umounting then the drive has NOT been umounted in the first place! ls /mnt/smb/ should work (at least as root!). Oh, and please move the output into your question so that it can be formatted correctly.
    – Ned64
    Feb 17 at 12:27











  • Sorry, my wrong. The output of mount | grep /mnt/smb after UMOUNT is empty line. My previous comment was output after MOUNT.
    – Hamid Reza
    Feb 17 at 12:55










  • Very good. Now, after the empty line, (a) can you list the files by php?, and (b) if you can, then please test the mount command again and let us know.
    – Ned64
    Feb 17 at 12:58












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I mounted a SMB share folder under /mnt/smb/ and I can access the files. When I unmount this shared folder using command:



umount /mnt/smb/


naturally I cannot list shared folder contents using command:



ls /mnt/smb/


But the problem is when I run the ls command from a PHP file on the same machine, the contents of shared SMB folder can be listed! The contents of PHP file is:



<?php
$command = 'ls /mnt/smb/';
$result = shell_exec($command);
echo $result;
?>


What is my mistake. Is there any other commanf needed for completely unmount the SMB share? I also used command below but there was no luck:



fusermount -u /mnt/smb/






share|improve this question












I mounted a SMB share folder under /mnt/smb/ and I can access the files. When I unmount this shared folder using command:



umount /mnt/smb/


naturally I cannot list shared folder contents using command:



ls /mnt/smb/


But the problem is when I run the ls command from a PHP file on the same machine, the contents of shared SMB folder can be listed! The contents of PHP file is:



<?php
$command = 'ls /mnt/smb/';
$result = shell_exec($command);
echo $result;
?>


What is my mistake. Is there any other commanf needed for completely unmount the SMB share? I also used command below but there was no luck:



fusermount -u /mnt/smb/








share|improve this question











share|improve this question




share|improve this question










asked Feb 17 at 9:28









Hamid Reza

152




152











  • Please also post the output of mount | grep /mnt/smb after umounting (when ls from the shell does not work), then also check whether the command gives the same result (hopefully, an empty line) after accessing from php. If there is a difference maybe the share is auto-mounted again. NB: If the output of the mount command contains a username or password, I suggest you remove it before posting.
    – Ned64
    Feb 17 at 9:45











  • The output is: //172.16.50.207/SoftBank on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=teknik,domain=OFIS-NAS,uid=0,noforceuid,gid=0,noforcegid,addr=172.16.50.207,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
    – Hamid Reza
    Feb 17 at 12:16










  • If that it the output after umounting then the drive has NOT been umounted in the first place! ls /mnt/smb/ should work (at least as root!). Oh, and please move the output into your question so that it can be formatted correctly.
    – Ned64
    Feb 17 at 12:27











  • Sorry, my wrong. The output of mount | grep /mnt/smb after UMOUNT is empty line. My previous comment was output after MOUNT.
    – Hamid Reza
    Feb 17 at 12:55










  • Very good. Now, after the empty line, (a) can you list the files by php?, and (b) if you can, then please test the mount command again and let us know.
    – Ned64
    Feb 17 at 12:58
















  • Please also post the output of mount | grep /mnt/smb after umounting (when ls from the shell does not work), then also check whether the command gives the same result (hopefully, an empty line) after accessing from php. If there is a difference maybe the share is auto-mounted again. NB: If the output of the mount command contains a username or password, I suggest you remove it before posting.
    – Ned64
    Feb 17 at 9:45











  • The output is: //172.16.50.207/SoftBank on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=teknik,domain=OFIS-NAS,uid=0,noforceuid,gid=0,noforcegid,addr=172.16.50.207,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
    – Hamid Reza
    Feb 17 at 12:16










  • If that it the output after umounting then the drive has NOT been umounted in the first place! ls /mnt/smb/ should work (at least as root!). Oh, and please move the output into your question so that it can be formatted correctly.
    – Ned64
    Feb 17 at 12:27











  • Sorry, my wrong. The output of mount | grep /mnt/smb after UMOUNT is empty line. My previous comment was output after MOUNT.
    – Hamid Reza
    Feb 17 at 12:55










  • Very good. Now, after the empty line, (a) can you list the files by php?, and (b) if you can, then please test the mount command again and let us know.
    – Ned64
    Feb 17 at 12:58















Please also post the output of mount | grep /mnt/smb after umounting (when ls from the shell does not work), then also check whether the command gives the same result (hopefully, an empty line) after accessing from php. If there is a difference maybe the share is auto-mounted again. NB: If the output of the mount command contains a username or password, I suggest you remove it before posting.
– Ned64
Feb 17 at 9:45





Please also post the output of mount | grep /mnt/smb after umounting (when ls from the shell does not work), then also check whether the command gives the same result (hopefully, an empty line) after accessing from php. If there is a difference maybe the share is auto-mounted again. NB: If the output of the mount command contains a username or password, I suggest you remove it before posting.
– Ned64
Feb 17 at 9:45













The output is: //172.16.50.207/SoftBank on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=teknik,domain=OFIS-NAS,uid=0,noforceuid,gid=0,noforcegid,addr=172.16.50.207,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
– Hamid Reza
Feb 17 at 12:16




The output is: //172.16.50.207/SoftBank on /mnt/smb type cifs (rw,relatime,vers=1.0,cache=strict,username=teknik,domain=OFIS-NAS,uid=0,noforceuid,gid=0,noforcegid,addr=172.16.50.207,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1)
– Hamid Reza
Feb 17 at 12:16












If that it the output after umounting then the drive has NOT been umounted in the first place! ls /mnt/smb/ should work (at least as root!). Oh, and please move the output into your question so that it can be formatted correctly.
– Ned64
Feb 17 at 12:27





If that it the output after umounting then the drive has NOT been umounted in the first place! ls /mnt/smb/ should work (at least as root!). Oh, and please move the output into your question so that it can be formatted correctly.
– Ned64
Feb 17 at 12:27













Sorry, my wrong. The output of mount | grep /mnt/smb after UMOUNT is empty line. My previous comment was output after MOUNT.
– Hamid Reza
Feb 17 at 12:55




Sorry, my wrong. The output of mount | grep /mnt/smb after UMOUNT is empty line. My previous comment was output after MOUNT.
– Hamid Reza
Feb 17 at 12:55












Very good. Now, after the empty line, (a) can you list the files by php?, and (b) if you can, then please test the mount command again and let us know.
– Ned64
Feb 17 at 12:58




Very good. Now, after the empty line, (a) can you list the files by php?, and (b) if you can, then please test the mount command again and let us know.
– Ned64
Feb 17 at 12:58










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Please repeat the umount command as needed, until the /mnt/smb folder is u(n)mounted according to ls in the shell. Then it should also be according to the mount command:



mount | grep /mnt/smb


so that the share really is not mounted any more. If some process still lists remote contents, it must be cached (unlikely in this php system call situation, though).



Any command can still see the mount point, of course, because it is a directory. Any local files that the directory contains will be listed, by php or from a shell.



In order to fix this last issue you could first move/remove the files from the local directory (while the share is not mounted), then do chmod 0 /mnt/smb as root to indicate the non-mountedness and create ls-errors while not mounted.






share|improve this answer






















  • Thanks, any way for removing cahce?
    – Hamid Reza
    Feb 17 at 12:12










  • @HamidReza Let's check whether the umount was successful, first.
    – Ned64
    Feb 17 at 12:33










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424750%2funmounting-smb-share-folder%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Please repeat the umount command as needed, until the /mnt/smb folder is u(n)mounted according to ls in the shell. Then it should also be according to the mount command:



mount | grep /mnt/smb


so that the share really is not mounted any more. If some process still lists remote contents, it must be cached (unlikely in this php system call situation, though).



Any command can still see the mount point, of course, because it is a directory. Any local files that the directory contains will be listed, by php or from a shell.



In order to fix this last issue you could first move/remove the files from the local directory (while the share is not mounted), then do chmod 0 /mnt/smb as root to indicate the non-mountedness and create ls-errors while not mounted.






share|improve this answer






















  • Thanks, any way for removing cahce?
    – Hamid Reza
    Feb 17 at 12:12










  • @HamidReza Let's check whether the umount was successful, first.
    – Ned64
    Feb 17 at 12:33














up vote
1
down vote



accepted










Please repeat the umount command as needed, until the /mnt/smb folder is u(n)mounted according to ls in the shell. Then it should also be according to the mount command:



mount | grep /mnt/smb


so that the share really is not mounted any more. If some process still lists remote contents, it must be cached (unlikely in this php system call situation, though).



Any command can still see the mount point, of course, because it is a directory. Any local files that the directory contains will be listed, by php or from a shell.



In order to fix this last issue you could first move/remove the files from the local directory (while the share is not mounted), then do chmod 0 /mnt/smb as root to indicate the non-mountedness and create ls-errors while not mounted.






share|improve this answer






















  • Thanks, any way for removing cahce?
    – Hamid Reza
    Feb 17 at 12:12










  • @HamidReza Let's check whether the umount was successful, first.
    – Ned64
    Feb 17 at 12:33












up vote
1
down vote



accepted







up vote
1
down vote



accepted






Please repeat the umount command as needed, until the /mnt/smb folder is u(n)mounted according to ls in the shell. Then it should also be according to the mount command:



mount | grep /mnt/smb


so that the share really is not mounted any more. If some process still lists remote contents, it must be cached (unlikely in this php system call situation, though).



Any command can still see the mount point, of course, because it is a directory. Any local files that the directory contains will be listed, by php or from a shell.



In order to fix this last issue you could first move/remove the files from the local directory (while the share is not mounted), then do chmod 0 /mnt/smb as root to indicate the non-mountedness and create ls-errors while not mounted.






share|improve this answer














Please repeat the umount command as needed, until the /mnt/smb folder is u(n)mounted according to ls in the shell. Then it should also be according to the mount command:



mount | grep /mnt/smb


so that the share really is not mounted any more. If some process still lists remote contents, it must be cached (unlikely in this php system call situation, though).



Any command can still see the mount point, of course, because it is a directory. Any local files that the directory contains will be listed, by php or from a shell.



In order to fix this last issue you could first move/remove the files from the local directory (while the share is not mounted), then do chmod 0 /mnt/smb as root to indicate the non-mountedness and create ls-errors while not mounted.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 17 at 14:45

























answered Feb 17 at 9:41









Ned64

2,44411035




2,44411035











  • Thanks, any way for removing cahce?
    – Hamid Reza
    Feb 17 at 12:12










  • @HamidReza Let's check whether the umount was successful, first.
    – Ned64
    Feb 17 at 12:33
















  • Thanks, any way for removing cahce?
    – Hamid Reza
    Feb 17 at 12:12










  • @HamidReza Let's check whether the umount was successful, first.
    – Ned64
    Feb 17 at 12:33















Thanks, any way for removing cahce?
– Hamid Reza
Feb 17 at 12:12




Thanks, any way for removing cahce?
– Hamid Reza
Feb 17 at 12:12












@HamidReza Let's check whether the umount was successful, first.
– Ned64
Feb 17 at 12:33




@HamidReza Let's check whether the umount was successful, first.
– Ned64
Feb 17 at 12:33












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424750%2funmounting-smb-share-folder%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay