<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Linux Forum &mdash; Не удается открыть общий доступ]]></title>
		<link>https://linuxforum.ru/viewtopic.php?id=12765</link>
		<atom:link href="https://linuxforum.ru/extern.php?action=feed&amp;tid=12765&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Не удается открыть общий доступ».]]></description>
		<lastBuildDate>Wed, 20 Apr 2011 18:34:34 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Не удается открыть общий доступ]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=170561#p170561</link>
			<description><![CDATA[<div class="quotebox"><cite>drBatty пишет:</cite><blockquote><p><strong>Remedy</strong>, может поправим наконец скрипт? дайте его напосмотреть..</p></blockquote></div><p>вот файл:</p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p>#!/usr/bin/perl -T</p><br /><p>########################################<br /># config files<br />$nfs_exports::default_options = &#039;*(ro,all_squash,sync,no_subtree_check)&#039;;<br />$nfs_exports::conf_file = &#039;/etc/exports&#039;;<br />$smb_exports::conf_file = &#039;/etc/samba/smb.conf&#039;;<br />my $authorisation_file = &#039;/etc/security/fileshare.conf&#039;;<br />my $authorisation_group = &#039;fileshare&#039;;</p><br /><p>########################################<br /># fileshare utility $Id: fileshareset 233183 2008-01-23 12:17:07Z tv $<br /># Copyright (C) 2001-2008 Mandriva (pixel@mandriva.com)<br />#<br /># This program is free software; you can redistribute it and/or modify<br /># it under the terms of the GNU General Public License as published by<br /># the Free Software Foundation; either version 2, or (at your option)<br /># any later version.<br />#<br /># This program is distributed in the hope that it will be useful,<br /># but WITHOUT ANY WARRANTY; without even the implied warranty of<br /># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp; See the<br /># GNU General Public License for more details.<br />#<br /># You should have received a copy of the GNU General Public License<br /># along with this program; if not, write to the Free Software<br /># Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</p><br /><p>########################################<br />my $uid = $&lt;;<br />my $username = getpwuid($uid);</p><p>########################################<br /># errors<br />my $usage =<br />&quot;usage: fileshareset --add &lt;dir&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;fileshareset --remove &lt;dir&gt;&quot;;</p><p>my $not_enabled =<br />qq(File sharing is not enabled.<br />To enable file sharing put <br />&quot;FILESHARING=yes&quot; in $authorisation_file);<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />my $not_simple_enabled = <br />qq(Simple file sharing is not enabled.<br />To enable simple file sharing put<br />&quot;SHARINGMODE=simple&quot; in $authorisation_file);</p><p>my $non_authorised =<br />qq(You are not authorised to use fileshare&#039;ing<br />To grant you the rights:<br />- put &quot;RESTRICT=no&quot; in $authorisation_file<br />- or put user &quot;$username&quot; in group &quot;$authorisation_group&quot;);<br />my $no_export_method = &quot;can not export anything: no nfs, no smb&quot;;</p><p>my %exit_codes = reverse(<br />&nbsp; 1 =&gt; $non_authorised,<br />&nbsp; 2 =&gt; $usage,</p><p># when adding<br />&nbsp; 3 =&gt; &quot;already exported&quot;, <br />&nbsp; 4 =&gt; &quot;invalid mount point&quot;,</p><p># when removing<br />&nbsp; 5 =&gt; &quot;not exported&quot;,</p><p>&nbsp; 6 =&gt; $no_export_method,<br />&nbsp; <br />&nbsp; 7 =&gt; $not_enabled,<br />&nbsp; <br />&nbsp; 8 =&gt; $not_simple_enabled,</p><p>&nbsp; 255 =&gt; &quot;various&quot;,<br />);</p><p>################################################################################<br /># correct PATH needed to call /etc/init.d/... ? seems not, but...<br />%ENV = ();#(PATH =&gt; &#039;/bin:/sbin:/usr/bin:/usr/sbin&#039;);</p><p>my $modify = $0 =~ /fileshareset/;</p><p>authorisation::check($modify);</p><p>my @exports = (<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; -e $nfs_exports::conf_file ? nfs_exports::read() : (),<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; -e $smb_exports::conf_file ? smb_exports::read() : (),<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;);<br />@exports or error($no_export_method);</p><p>if ($modify) {<br />&nbsp; &nbsp; my ($cmd, $dir) = @ARGV;<br />&nbsp; &nbsp; $&lt; = $&gt;;<br />&nbsp; &nbsp; @ARGV == 2 &amp;&amp; ($cmd eq &#039;--add&#039; || $cmd eq &#039;--remove&#039;) or error($usage);</p><p>&nbsp; &nbsp; verify_mntpoint($dir);</p><p>&nbsp; &nbsp; if ($cmd eq &#039;--add&#039;) {<br />&nbsp; &nbsp; my @errs = map { eval { $_-&gt;add($dir) }; $@ } @exports;<br />&nbsp; &nbsp; grep { !$_ } @errs or error(&quot;already exported&quot;);<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; my @errs = map { eval { $_-&gt;remove($dir) }; $@ } @exports;<br />&nbsp; &nbsp; grep { !$_ } @errs or error(&quot;not exported&quot;);<br />&nbsp; &nbsp; }&nbsp; &nbsp; <br />&nbsp; &nbsp; foreach my $export (@exports) {<br />&nbsp; &nbsp; $export-&gt;write;<br />&nbsp; &nbsp; $export-&gt;update_server;<br />&nbsp; &nbsp; }<br />}<br />my @mntpoints = grep { $_ } uniq(map { map { $_-&gt;{mntpoint} } @$_ } @exports);<br />print &quot;$_\n&quot; foreach grep { own($_) } @mntpoints;</p><br /><p>sub own { $uid == 0 || (stat($_[0]))[4] == $uid }</p><p>sub verify_mntpoint {<br />&nbsp; &nbsp; local ($_) = @_;<br />&nbsp; &nbsp; my $ok = 1;<br />&nbsp; &nbsp; $ok &amp;&amp;= m|^/|;<br />&nbsp; &nbsp; $ok &amp;&amp;= !m|\Q/../|;<br />&nbsp; &nbsp; $ok &amp;&amp;= !m|[\0\n\r]|;<br />&nbsp; &nbsp; $ok &amp;&amp;= -d $_;<br />&nbsp; &nbsp; $ok &amp;&amp;= own($_);<br />&nbsp; &nbsp; $ok or error(&quot;invalid mount point&quot;);<br />}</p><p>sub error {<br />&nbsp; &nbsp; my ($string) = @_;<br />&nbsp; &nbsp; print STDERR &quot;$string\n&quot;;<br />&nbsp; &nbsp; exit($exit_codes{$string} || 255);<br />}<br />sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }<br />sub uniq { my %l; $l{$_} = 1 foreach @_; grep { delete $l{$_} } @_ }</p><br /><p>################################################################################<br />package authorisation;</p><p>my $F_lock;<br />sub read_conf {<br />&nbsp; &nbsp; my ($exclusive_lock) = @_;<br />&nbsp; &nbsp; open $F_lock, $authorisation_file; # do not care if it&#039;s missing<br />&nbsp; &nbsp; flock($F_lock, $exclusive_lock ? 2 : 1) or die &quot;can not lock&quot;;<br />&nbsp; &nbsp; my %conf;<br />&nbsp; &nbsp; foreach (&lt;$F_lock&gt;) {<br />&nbsp; &nbsp; s/#.*//; # remove comments<br />&nbsp; &nbsp; s/^\s+//; <br />&nbsp; &nbsp; s/\s+$//;<br />&nbsp; &nbsp; /^$/ and next;<br />&nbsp; &nbsp; my ($cmd, $value) = split(&#039;=&#039;, $_, 2);<br />&nbsp; &nbsp; $conf{$cmd} = $value || warn qq(suspicious line &quot;$_&quot; in $authorisation_file\n);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; # no close $F_lock, keep it locked<br />&nbsp; &nbsp; \%conf<br />}</p><p>sub check {<br />&nbsp; &nbsp; my ($exclusive_lock) = @_;<br />&nbsp; &nbsp; my $conf = read_conf($exclusive_lock);</p><p>&nbsp; &nbsp; if (lc($conf-&gt;{FILESHARING}) eq &#039;no&#039;) {<br />&nbsp; &nbsp; &nbsp; ::error($not_enabled);<br />&nbsp; &nbsp; } elsif (lc($conf-&gt;{SHARINGMODE}) eq &#039;advanced&#039;) {<br />&nbsp; &nbsp; &nbsp; ::error($not_simple_enabled);<br />&nbsp; &nbsp; } elsif ($conf-&gt;{FILESHAREGROUP}) {<br />&nbsp; &nbsp; &nbsp; $authorisation_group = $conf-&gt;{FILESHAREGROUP};<br />&nbsp; &nbsp; } elsif (lc($conf-&gt;{RESTRICT}) eq &#039;no&#039;) {<br />&nbsp; &nbsp; # ok, access granted for everybody<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; my @l;<br />&nbsp; &nbsp; while (@l = getgrent) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;last if $l[0] eq $authorisation_group;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; ::member($username, split(&#039; &#039;, $l[3])) or ::error($non_authorised);<br />&nbsp; &nbsp; }<br />}</p><p>################################################################################<br />package exports;</p><p>sub find {<br />&nbsp; &nbsp; my ($exports, $mntpoint) = @_;<br />&nbsp; &nbsp; foreach (@$exports) {<br />&nbsp; &nbsp; $_-&gt;{mntpoint} eq $mntpoint and return $_;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; undef;<br />}</p><p>sub add {<br />&nbsp; &nbsp; my ($exports, $mntpoint) = @_;<br />&nbsp; &nbsp; find($exports, $mntpoint) and die &#039;add&#039;;<br />&nbsp; &nbsp; push @$exports, my $e = { mntpoint =&gt; $mntpoint };<br />&nbsp; &nbsp; $e;<br />}</p><p>sub remove {<br />&nbsp; &nbsp; my ($exports, $mntpoint) = @_;<br />&nbsp; &nbsp; my @l = grep { $_-&gt;{mntpoint} ne $mntpoint } @$exports;<br />&nbsp; &nbsp; @l &lt; @$exports or die &#039;remove&#039;;<br />&nbsp; &nbsp; @$exports = @l;&nbsp; <br />}</p><br /><p>################################################################################<br />package nfs_exports;</p><br /><p>BEGIN { @ISA = &#039;exports&#039; }</p><p>sub read() {<br />&nbsp; &nbsp; my $file = $conf_file;<br />&nbsp; &nbsp; open(my $F, $file) or return [];</p><p>&nbsp; &nbsp; my ($prev_raw, $prev_line, @l);<br />&nbsp; &nbsp; my $line_nb = 0;<br />&nbsp; &nbsp; foreach my $raw (&lt;$F&gt;) {<br />&nbsp; &nbsp; $line_nb++;<br />&nbsp; &nbsp; local $_ = $raw;<br />&nbsp; &nbsp; $raw .= &quot;\n&quot; if !/\n/;</p><p>&nbsp; &nbsp; s/#.*//; # remove comments</p><p>&nbsp; &nbsp; s/^\s+//; <br />&nbsp; &nbsp; s/\s+$//; # remove unuseful spaces to help regexps</p><p>&nbsp; &nbsp; if (/^$/) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;# blank lines ignored<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$prev_raw .= $raw;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;next;<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; if (/\\$/) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;# line continue across lines<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;chop; # remove the backslash<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$prev_line .= &quot;$_ &quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$prev_raw .= $raw;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;next;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; my $line = $prev_line . $_;<br />&nbsp; &nbsp; my $raw_line = $prev_raw . $raw;<br />&nbsp; &nbsp; ($prev_line, $prev_raw) = (&#039;&#039;, &#039;&#039;);</p><p>&nbsp; &nbsp; my ($mntpoint, $options) = $line =~ /(&quot;[^&quot;]*&quot;|\S+)\s+(.*)/ or die &quot;$file:$line_nb: bad line $line\n&quot;;</p><p>&nbsp; &nbsp; # You can also specify spaces or any other unusual characters in the<br />&nbsp; &nbsp; # export path name using a backslash followed by the character code as<br />&nbsp; &nbsp; # 3 octal digits.<br />&nbsp; &nbsp; $mntpoint =~ s/\\(\d{3})/chr(oct $1)/ge;</p><p>&nbsp; &nbsp; # not accepting weird characters that would break the output<br />&nbsp; &nbsp; $mntpoint =~ m/[\0\n\r]/ and die &quot;i will not handle this&quot;;<br />&nbsp; &nbsp; push @l, { mntpoint =&gt; $mntpoint, option =&gt; $options, raw =&gt; $raw_line };<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; bless \@l, &#039;nfs_exports&#039;;<br />}</p><p>sub write {<br />&nbsp; &nbsp; my ($nfs_exports) = @_;<br />&nbsp; &nbsp; foreach (@$nfs_exports) {<br />&nbsp; &nbsp; if (!exists $_-&gt;{options}) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$_-&gt;{options} = $default_options;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; if (!exists $_-&gt;{raw}) {&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;my $mntpoint = $_-&gt;{mntpoint} =~ /\s/ ? qq(&quot;$_-&gt;{mntpoint}&quot;) : $_-&gt;{mntpoint};<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$_-&gt;{raw} = sprintf(&quot;%s %s\n&quot;, $mntpoint, $_-&gt;{options});<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; open(my $F, &quot;&gt;$conf_file&quot;) or die &quot;can not write $conf_file&quot;;<br />&nbsp; &nbsp; print $F $_-&gt;{raw} foreach @$nfs_exports;<br />}</p><p>sub update_server() {<br />&nbsp; &nbsp; if (fork()) {<br />&nbsp; &nbsp; system(&#039;/usr/sbin/exportfs&#039;, &#039;-r&#039;);<br />&nbsp; &nbsp; if (system(&#039;PATH=/bin:/sbin pidof rpc.mountd &gt;/dev/null&#039;) != 0 ||<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;system(&#039;PATH=/bin:/sbin pidof nfsd &gt;/dev/null&#039;) != 0) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;# trying to start the server...<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;system(&#039;/etc/init.d/portmap start&#039;) if system(&#039;/etc/init.d/portmap status &gt;/dev/null&#039;) != 0;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;system(&#039;/etc/init.d/nfs&#039;, $_) foreach &#039;stop&#039;, &#039;start&#039;;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; exit 0;<br />&nbsp; &nbsp; }<br />}</p><p>################################################################################<br />package smb_exports;</p><br /><p>BEGIN { @ISA = &#039;exports&#039; }</p><p>sub read() {<br />&nbsp; &nbsp; my ($s, @l);<br />&nbsp; &nbsp; open(my $F, $conf_file);<br />&nbsp; &nbsp; local $_;<br />&nbsp; &nbsp; while (&lt;$F&gt;) {<br />&nbsp; &nbsp; if (/^\s*\[.*\]/ || eof $F) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;#- first line in the category<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;my ($label) = $s =~ /^\s*\[(.*)\]/;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;my ($mntpoint) = $s =~ /^\s*path\s*=\s*(.*)/m;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;push @l, { mntpoint =&gt; $mntpoint, raw =&gt; $s, label =&gt; $label };<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$s = &#039;&#039;;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; $s .= $_;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; bless \@l, &#039;smb_exports&#039;;<br />}</p><p>sub write {<br />&nbsp; &nbsp; my ($smb_exports) = @_;<br />&nbsp; &nbsp; foreach (@$smb_exports) {<br />&nbsp; &nbsp; if (!exists $_-&gt;{raw}) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$_-&gt;{raw} = &lt;&lt;EOF;</p><p>[$_-&gt;{label}]<br />&nbsp; &nbsp;path = $_-&gt;{mntpoint}<br />&nbsp; &nbsp;comment = $_-&gt;{mntpoint}<br />&nbsp; &nbsp;public = yes<br />&nbsp; &nbsp;guest ok = yes<br />&nbsp; &nbsp;writable = no<br />&nbsp; &nbsp;wide links = no<br />EOF<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; open(my $F, &quot;&gt;$conf_file&quot;) or die &quot;can not write $conf_file&quot;;<br />&nbsp; &nbsp; print $F $_-&gt;{raw} foreach @$smb_exports;<br />}</p><p>sub add {<br />&nbsp; &nbsp; my ($exports, $mntpoint) = @_;<br />&nbsp; &nbsp; my $e = $exports-&gt;exports::add($mntpoint);<br />&nbsp; &nbsp; $e-&gt;{label} = name_mangle($mntpoint, map { $_-&gt;{label} } @$exports);<br />}</p><p>sub name_mangle {<br />&nbsp; &nbsp; my ($input, @others) = @_;</p><p>&nbsp; &nbsp; local $_ = $input;</p><p>&nbsp; &nbsp; # 1. first only keep legal characters. &quot;/&quot; is also kept for the moment<br />&nbsp; &nbsp; tr|a-z|A-Z|;<br />&nbsp; &nbsp; s|[^A-Z0-9#\-_!/]|_|g; # &quot;$&quot; is allowed except at the end, remove it in any case<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; # 2. removing non-interesting parts<br />&nbsp; &nbsp; s|^/||;<br />&nbsp; &nbsp; s|^home/||;<br />&nbsp; &nbsp; s|_*/_*|/|g;<br />&nbsp; &nbsp; s|_+|_|g;</p><p>&nbsp; &nbsp; # 3. if size is too small (!), make it bigger<br />&nbsp; &nbsp; $_ .= &quot;_&quot; while length($_) &lt; 3;</p><p>&nbsp; &nbsp; # 4. if size is too big, shorten it<br />&nbsp; &nbsp; while (length &gt; 12) {<br />&nbsp; &nbsp; my ($s) = m|.*?/(.*)|;<br />&nbsp; &nbsp; if (length($s) &gt; 8 &amp;&amp; !grep { /\Q$s/ } @others) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;# dropping leading directories when the resulting is still long and meaningful<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$_ = $s;<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;s|(.*)[0-9#\-_!/]|$1|<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;# inspired by &quot;Christian Brolin&quot; &quot;Long names are doom&quot; on comp.lang.functional<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;|| s|(.+)[AEIOU]|$1|# allButFirstVowels<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;|| s|(.*)(.)\2|$1$2| # adjacentDuplicates<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;|| s|(.*).|$1|; # booh, :&#039;-(<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; # 5. remove &quot;/&quot;s still there<br />&nbsp; &nbsp; s|/|_|g;</p><p>&nbsp; &nbsp; # 6. resolving conflicts<br />&nbsp; &nbsp; my $l = join(&quot;|&quot;, map { quotemeta } @others);<br />&nbsp; &nbsp; my $conflicts = qr|^($l)$|;<br />&nbsp; &nbsp; if (/$conflicts/) {<br />&nbsp; &nbsp; &nbsp; A: while (1) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;for (my $nb = 1; length(&quot;$_$nb&quot;) &lt;= 12; $nb++) {<br />&nbsp; &nbsp; &nbsp; &nbsp; if (&quot;$_$nb&quot; !~ /$conflicts/) {<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$_ = &quot;$_$nb&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;last A;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$_ or die &quot;can not find a unique name&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;# can not find a unique name, dropping the last letter<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;s|(.*).|$1|;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; # 7. done<br />&nbsp; &nbsp; $_;<br />}</p><p>sub update_server() {<br />&nbsp; &nbsp; if (fork()) {<br />&nbsp; &nbsp; system(&#039;/usr/bin/killall -HUP smbd 2&gt;/dev/null&#039;);<br />&nbsp; &nbsp; if (system(&#039;PATH=/bin:/sbin pidof smbd &gt;/dev/null&#039;) != 0 ||<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;system(&#039;PATH=/bin:/sbin pidof nmbd &gt;/dev/null&#039;) != 0) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;# trying to start the server...<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;my ($f) = grep { -f $_ } map { &quot;/etc/init.d/$_&quot; } &#039;smb&#039;, &#039;samba&#039;, &#039;rc.samba&#039;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;if ($f) {<br />&nbsp; &nbsp; &nbsp; &nbsp; system($f, $_) foreach &#039;stop&#039;, &#039;start&#039;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;} else {<br />&nbsp; &nbsp; &nbsp; &nbsp; print STDERR &quot;Error: Can&#039;t find the samba init script \n&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; exit 0;<br />&nbsp; &nbsp; }<br />}</p></div></div>]]></description>
			<author><![CDATA[null@example.com (Hazker)]]></author>
			<pubDate>Wed, 20 Apr 2011 18:34:34 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=170561#p170561</guid>
		</item>
		<item>
			<title><![CDATA[Re: Не удается открыть общий доступ]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=168361#p168361</link>
			<description><![CDATA[<p><strong>Remedy</strong>, может поправим наконец скрипт? дайте его напосмотреть..</p>]]></description>
			<author><![CDATA[null@example.com (drBatty)]]></author>
			<pubDate>Thu, 14 Apr 2011 05:36:35 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=168361#p168361</guid>
		</item>
		<item>
			<title><![CDATA[Re: Не удается открыть общий доступ]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=168304#p168304</link>
			<description><![CDATA[<div class="quotebox"><cite>Remedy пишет:</cite><blockquote><p>Не совсем правильно выразился. Не Samba не распознаёт, а скрипт <strong>fileshareset</strong>, использующий <strong>samba</strong>.</p></blockquote></div><br /><p>Спасибо за помощь и разъяснения. Изменил название расшареной папки и все заработало</p>]]></description>
			<author><![CDATA[null@example.com (Hazker)]]></author>
			<pubDate>Wed, 13 Apr 2011 20:33:58 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=168304#p168304</guid>
		</item>
		<item>
			<title><![CDATA[Re: Не удается открыть общий доступ]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=168126#p168126</link>
			<description><![CDATA[<p>Не совсем правильно выразился. Не Samba не распознаёт, а скрипт <strong>fileshareset</strong>, использующий <strong>samba</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (Remedy)]]></author>
			<pubDate>Wed, 13 Apr 2011 13:07:05 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=168126#p168126</guid>
		</item>
		<item>
			<title><![CDATA[Re: Не удается открыть общий доступ]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=168124#p168124</link>
			<description><![CDATA[<p>Samba не распознаёт имена шар с пробелами. Если у вас в имени расшаренного каталога есть пробелы - замените их, например, на нижнее подчёркивание (<strong>_</strong>).</p>]]></description>
			<author><![CDATA[null@example.com (Remedy)]]></author>
			<pubDate>Wed, 13 Apr 2011 13:03:40 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=168124#p168124</guid>
		</item>
		<item>
			<title><![CDATA[Не удается открыть общий доступ]]></title>
			<link>https://linuxforum.ru/viewtopic.php?pid=168104#p168104</link>
			<description><![CDATA[<p>Добрый день. Установил на буке mandriva linux 2010 i586. С ОС windows знаком неплого, а вот с Linux совсем не знаком. Итак сначала решил открыть общий доступ к папке в linux. Иду домашнюю директорию, нахожу нужную в свойства директории открываю вкладку общий доступ. Нажимаю настроить общий доступ - разрешить всем пользователям - ставлю галку smb и нажимаю ок. Затем нажимаю &quot;радиобатон&quot; общий доступ открыт. Вылазиет сообщение об ошибке:</p><p>error while running /usr/sbin/fileshareset</p><p>после нажатия на ок сообщение закрывается, но доступа сообтветственно нет. </p><p>В чем проблема? Как ее разрешить? linux никогда не пользовал, хочется разобраться. В гугле ответа на свой прос не нашел. Искал на русскоязычных сайтах, т.к. очень плохо знаю английский. </p><p>PS заранее спасибо за реальную помошь. Прошу оставить при себе фразы типа: гугл поможет и т.п. Если бы знал/нашел ответ, то не спрашивал бы</p>]]></description>
			<author><![CDATA[null@example.com (Hazker)]]></author>
			<pubDate>Wed, 13 Apr 2011 11:15:02 +0000</pubDate>
			<guid>https://linuxforum.ru/viewtopic.php?pid=168104#p168104</guid>
		</item>
	</channel>
</rss>
