{"id":3205,"date":"2018-10-26T14:55:29","date_gmt":"2018-10-26T14:55:29","guid":{"rendered":"https:\/\/tst-amo.net.ua\/blog\/?p=3205"},"modified":"2019-02-05T05:34:01","modified_gmt":"2019-02-05T05:34:01","slug":"samba-%d0%bf%d0%be%d0%b4%d0%ba%d0%bb%d1%8e%d1%87%d0%b5%d0%bd%d0%b8%d0%b5-windows-linux","status":"publish","type":"post","link":"https:\/\/tst-amo.net.ua\/blog\/?p=3205","title":{"rendered":"Samba &#8211; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 Windows \u0438 Linux"},"content":{"rendered":"<h4>Windows<\/h4>\r\n<pre class=\"dos\"><strong>C:\\&gt; net view \\\\192.168.1.1<\/strong>\r\nShared resources at \\\\192.168.1.1\r\nShare name Type Used as Comment\r\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\npub             Disk\r\nprivate Disk\r\nThe command completed successfully.\r\n\r\n<strong>C:\\&gt; net use j: \\\\192.168.1.1\\pub<\/strong>\r\n\r\nThe command completed successfully.<\/pre>\r\n<p class=\"obichnij\">\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0437\u043d\u0430\u0447\u043e\u043a \u041c\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0421\u0435\u0440\u0432\u0438\u0441, \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0434\u0438\u0441\u043a.<\/p>\r\n<h4>Linux<\/h4>\r\n<pre class=\"dos\"># mount -t smbfs -o username=smbguest \/\/192.168.1.1\/pub \/mnt\r\n# mount -t cifs -o user=smbguest \/\/192.168.1.1\/pub \/mnt<\/pre>\r\n<p>\u0427\u0435\u0440\u0435\u0437 credsfile (Linux Mint):<\/p>\r\n<pre>root@note:~# cat \/root\/credsfile \r\nusername=<span style=\"color: #ff0000;\">_username_<\/span>\r\npassword=<span style=\"color: #ff0000;\">_password_<\/span><\/pre>\r\n<pre>root@note:~# chmod <span style=\"color: #ff0000;\">400<\/span>\u00a0\/root\/credsfile<\/pre>\r\n<pre>root@note:~# cat \/etc\/fstab\r\nUUID=2df6c92d-2156-426c-9a1a-a08fba2c52f8 \/ ext4 errors=remount-ro 0 1\r\n# \/home was on \/dev\/sda6 during installation\r\nUUID=d512fc6a-5e9b-48db-9e26-e94eda009f6f \/home ext4 defaults 0 2\r\n\/swapfile none swap sw 0 0\r\n\r\n\/\/192.168.1.41\/box \/mnt\/box cifs _netdev,credentials=\/root\/credsfile,uid=<span style=\"color: #ff0000;\">1000<\/span>,gid=<span style=\"color: #ff0000;\">1000<\/span> 0 0\r\n\/\/192.168.1.41\/share \/mnt\/share cifs _netdev,credentials=\/root\/credsfile,uid=<span style=\"color: #ff0000;\">1000<\/span>,gid=<span style=\"color: #ff0000;\">1000<\/span> 0 0\r\n\/\/192.168.1.41\/video \/mnt\/video cifs _netdev,credentials=\/root\/credsfile,uid=<span style=\"color: #ff0000;\">1000<\/span>,gid=<span style=\"color: #ff0000;\">1000<\/span> 0 0\r\n\/\/192.168.1.41\/data \/mnt\/data cifs _netdev,credentials=\/root\/credsfile,uid=<span style=\"color: #ff0000;\">1000<\/span>,gid=<span style=\"color: #ff0000;\">1000<\/span> 0 0<\/pre>\r\n<pre># id <span style=\"color: #ff0000;\">_username_<\/span>\r\nuid=1000(<span style=\"color: #ff0000;\">_username_<\/span>) gid=1000(<span style=\"color: #ff0000;\">_username_<\/span>) \u0433\u0440\u0443\u043f\u043f\u044b=1000(<span style=\"color: #ff0000;\">_username_<\/span>),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),115(lpadmin),128(sambashare)<\/pre>\r\n\r\n<p>\u041c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <span style=\"color: #ff0000;\">\u0432\u0441\u0435\u0445 \u0448\u0430\u0440<\/span> \u0432\u0440\u0443\u0447\u043d\u0443\u044e (credsfile \u0438 fstab):<\/p>\r\n<pre>#\u00a0mount -a cifs<br \/><br \/># mount | grep cifs<br \/>\/\/192.168.1.41\/share on \/mnt\/share type cifs (rw,relatime,vers=default,cache=strict,username=svm,domain=,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.1.41,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1,_netdev)<br \/>\/\/192.168.1.41\/video on \/mnt\/video type cifs (rw,relatime,vers=default,cache=strict,username=svm,domain=,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.1.41,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1,_netdev)<br \/>\/\/192.168.1.41\/data on \/mnt\/data type cifs (rw,relatime,vers=default,cache=strict,username=svm,domain=,uid=1000,forceuid,gid=1000,forcegid,addr=192.168.1.41,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1,_netdev)<\/pre>\r\n<p>\u0420\u0430\u0437\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0430\u043c\u0431\u0430-\u0448\u0430\u0440\u044b \u043d\u0430 Linux:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\"># umount -a -t cifs -l<\/pre>\r\n<p><strong>UPD.<\/strong> \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f Linux Mint (19.1) \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b\u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0448\u0430\u0440\u044b \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435. \u041f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u043b\u043e\u0433\u043e\u0432 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e fstab \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u0441\u0435\u0442\u044c. \u041e\u043f\u0446\u0438\u044f _netdev\u00a0 \u043d\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430:<\/p>\r\n<pre># cat \/var\/log\/boot.log\u00a0<br \/>.......<br \/>       Mounting \/mnt\/share...<br \/>       Mounting \/mnt\/data...<br \/>       Mounting \/mnt\/video...<br \/>[.[0;1;31mFAILED.[0m] Failed to mount \/mnt\/share.<br \/>See 'systemctl status mnt-share.mount' for details.<br \/>[.[0;1;33mDEPEND.[0m] Dependency failed for Remote File Systems.<\/pre>\r\n<pre>root@note:\/var\/log# systemctl status mnt-data.mount<br \/>Warning: The unit file, source configuration file or drop-ins of mnt-data.mount changed on disk. Run 'systemctl daemon-reload' to reload units.<br \/>\u25cf mnt-data.mount - \/mnt\/data<br \/>  Loaded: loaded (\/etc\/fstab; generated)<br \/>  Active: failed (Result: exit-code) since Tue 2019-02-05 07:18:29 EET; 12min ago<br \/>   Where: \/mnt\/data<br \/>    What: \/\/192.168.1.41\/data<br \/>    Docs: man:fstab(5)<br \/>          man:systemd-fstab-generator(8)<br \/>Process: 756 ExecMount=\/bin\/mount \/\/192.168.1.41\/data \/mnt\/data -t cifs -o _netdev,credentials=\/root\/credsfile,uid=1000,gid=1000 (code=exited, status=32)<br \/><br \/>\u0444\u0435\u0432 05 07:18:29 note systemd[1]: Mounting \/mnt\/data...<br \/>\u0444\u0435\u0432 05 07:18:29 note mount[756]: mount error(101): Network is unreachable<br \/>\u0444\u0435\u0432 05 07:18:29 note mount[756]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)<br \/>\u0444\u0435\u0432 05 07:18:29 note systemd[1]: mnt-data.mount: Mount process exited, code=exited status=32<br \/>\u0444\u0435\u0432 05 07:18:29 note systemd[1]: mnt-data.mount: Failed with result 'exit-code'.<br \/>\u0444\u0435\u0432 05 07:18:29 note systemd[1]: Failed to mount \/mnt\/data.<\/pre>\r\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435.<\/strong> \u0443\u0431\u0438\u0440\u0430\u0435\u043c _netdev \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u00a0auto,x-systemd.automount, \u0442.\u0435.:<\/p>\r\n<pre>root@note:\/etc# cat fstab <br \/>#\/\/192.168.1.41\/data \/mnt\/data cifs _netdev,credentials=\/root\/credsfile,uid=1000,gid=1000 0 0<br \/>\/\/192.168.1.41\/share \/mnt\/share cifs <span style=\"color: #ff0000;\">auto,x-systemd.automount<\/span>,credentials=\/root\/credsfile,uid=1000,gid=1000 0 0<br \/>\/\/192.168.1.41\/video \/mnt\/video cifs <span style=\"color: #ff0000;\">auto,x-systemd.automount<\/span>,credentials=\/root\/credsfile,uid=1000,gid=1000 0 0<br \/>\/\/192.168.1.41\/data \/mnt\/data cifs <span style=\"color: #ff0000;\">auto,x-systemd.automount<\/span>,credentials=\/root\/credsfile,uid=1000,gid=1000 0 0<\/pre>\r\n<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-bottom-right\"><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts3205&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts3205&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>Windows C:\\&gt; net view \\\\192.168.1.1 Shared resources at \\\\192.168.1.1 Share name Type Used as Comment \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013 pub Disk private Disk The command completed successfully. C:\\&gt; net use j: \\\\192.168.1.1\\pub The command completed successfully. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0437\u043d\u0430\u0447\u043e\u043a \u041c\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0421\u0435\u0440\u0432\u0438\u0441, \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0434\u0438\u0441\u043a. Linux # mount -t smbfs -o &#8230;<\/p>\n<p><a href=\"https:\/\/tst-amo.net.ua\/blog\/?p=3205\" class=\"more-link\">Continue reading &lsquo;Samba &#8211; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 Windows \u0438 Linux&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,76,44],"tags":[],"class_list":["post-3205","post","type-post","status-publish","format-standard","hentry","category-linux","category-samba","category-windows"],"_links":{"self":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3205"}],"collection":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3205"}],"version-history":[{"count":7,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3205\/revisions"}],"predecessor-version":[{"id":3685,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3205\/revisions\/3685"}],"wp:attachment":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}