Debian8.1 installing Samba with Windows shared files cannot be resolved by itself

Source: Internet
Author: User

Debian8.1 installation configuration is complete and the file is successfully shared with Windows but after the system restarts, the following issues occur

Resolution of (figure)

Manually restart Samba after a problem occurs

Sudo/etc/init.d/samba start

Again from the window to access the success, so I now cognitive decision to manually write a script boot automatically start Samba server

How to add this boot autorun script

1. Script content and its simplicity

#! /bin/bash### BEGIN INIT info# provides:          start_samba# Required-start:    $all # Required-  stop:# default-start:     2345# default-stop:      0  16#Shortif  it exist### END INIT INFOsudo  /etc/init.d/samba Start

The above pile does not know what the meaning, but there will be no warning do not know whether the removal will not affect the execution of the script.

2. Add execute permissions and copy to startup directory after script completion

sudo chmod

sudo cp start_samba/etc/init.d/

3. Test run Discovery Issues

[Email protected]:~$./Start_samba [sudo for FA:

4. Start looking for the configuration questions about sudo as summarized below

One, Sudo has the following features:

1.sudo can restrict the specified user from running certain commands on the specified host.

2.sudo can provide logs, faithfully record what each user has done with sudo, and can upload logs to a central host or log server.

3.sudo provides a configuration file for system administrators that allows system administrators to centrally manage user permissions and hosts used by users. Its default storage location is/etc/sudoers.
4.sudo uses timestamp files to complete a system similar to "wicket". When the user executes sudo and enters the password, the user obtains a "ticket" with a default survival period of 5 minutes (the default value can be changed at compile time). After the timeout, the user must re-enter the password.

sudo other commonly used parameters:

option meaning and function

    • Sudo-h help lists how to use, exit.
    • Sudo-v version Displays the release information and exits.
    • Sudo-l list lists the commands that the current user can execute. This option is available only to users in Sudoers.
    • Sudo-u Username#uiduser executes the command as the specified user. The following users are other than root, which can be either a user name or a #uid.
    • Sudo-k kill clears the time on the "entry volume" and enters the password again the next time you use sudo.
    • Sudo-k Surekill is similar to-K, but it also rips the "entry volume", which is to delete the timestamp file.
    • Sudo-b Commandbackground executes the specified command in the background.

Three. Configure sudo

By editing the/etc/sudoers file, and only the superuser can modify it, you must also use Visudo editing. There are two reasons why you can use Visudo, one is that it prevents

Two users modify it at the same time, and the second is that it can perform a limited grammar check. So, even if you are only a superuser, you'd better use Visudo to check the syntax.

The content section of its configuration file is as follows:

# User Privilege Specificationroot    all =(all:all) Allfa      all =sudo to execute any command%sudo    All=(all:all) all# See Sudoers (5for more"#include "  /ETC/SUDOERS.D

Three all: The first refers to the host in the network, and the second two in parentheses refers to who can perform the Sudo-u command (two selected) all in the example

can be executed as any user, and the name of a command that can be executed at the third time. The second one can be set in the Sudoers file as a default

Defaults:user Runas_default=user1

For example:

Allows user users to execute any root executable command via sudo

User   all= (all:all) all

You can also specify a command that user uses sudo to execute

User localhost=/sbin/ifconfig,/bin/ls

And then execute the other commands that are not part of the above-defined command to get the following output

' /usr/bin/'

Defaults If there is a colon, it is the default for the subsequent user, and if not, it is the default for all users. Just like the one line in the configuration file: Defaultsenv_reset

Now to the point of this article is to let the running

sudo /etc/init.d/samba  start

You no longer need to enter a password

User Nanopi2=nopasswd:/etc/init.d/samba

Then which of the above scripts will run.

How to run automatically

    • On top of it, run the script CP to/etc/init.d/and execute it.
      sudo updata-rc.d   start_samba  defaults   

      Where the number is the boot order is larger, the higher the start.

    • To remove this startup item, simply execute the
      sudo updata-rc.d-  f  Start_samba   Remove

Reference post: http://www.jb51.net/article/48390.htm

Https://www.magentonotes.com/ubuntu-config-autostart-shell-script.html

Debian8.1 installing Samba with Windows shared files cannot be resolved by itself

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.