zoukankan      html  css  js  c++  java
  • samba服务+vscode 实现代码快速修改生效到服务器上

    背景

    samba服务+vscode 实现代码快速修改生效到服务器上

    最终实现,开发的编辑器与远程的linux目录下的代码联动起来,实现本地修改与远程代码同步。

    step1

    linux服务上安装samba服务,实现远程linux服务机器与本地机器文件共享。(备注:该教程在linux上使用的root用户)

    centos系统

    1. yum install -y samba
    2.  vi /etc/samba/smb.conf
      1. # See smb.conf.example for a more detailed config file or
        # read the smb.conf manpage.
        # Run 'testparm' to verify the config is correct after
        # you modified it.
        
        [global]
                workgroup = SAMBA
                security = user
        
                passdb backend = tdbsam
        
                printing = cups
                printcap name = cups
                load printers = yes
                cups options = raw
        
        [homes]
                comment = Home Directories
                valid users = %S, %D%w%S
                browseable = No
                read only = No
                inherit acls = Yes
        
        [printers]
                comment = All Printers
                path = /var/tmp
                printable = Yes
                create mask = 0600
                browseable = No
        
        [print$]
                comment = Printer Drivers
                path = /var/lib/samba/drivers
                write list = @printadmin root
                force group = @printadmin
                create mask = 0664
                directory mask = 0775
        
        ### 以下为新增 ###
        [root] 
                comment = user root share files # 随意写,描述用途
                path = /root # 共享linux的目录
                writable = yes #将linux共享的目录实现可写操作
                public = no
      2. 将root用户添加到samba的服务中
        1.   smbpasswd -a root (添加过程中要输入密码,记住该密码,远程登陆的时候需要)
      3.  重启samba服务:systemctl restart smb

    ubuntu系统

    1.  安装samba: sudo apt-get install samba samba-common
    2. 配置smb.conf : vi /etc/samba/smb.conf 在该文件中追加如下代码   
    [share]
    comment = share folder
    browseable = yes
    path = /root # 要共享的目录
    create mask = 0700
    directory mask = 0700
    valid users = root
    force user = root
    force group = root
    public = yes 
    available = yes 
    writable = yes

      3. smb添加用户: smbpasswd -a root

      4. 重启smb服务: service smbd restart

    step2 本地windows电脑上的操作

      1. 网络连接远程机器的ip,如下图所示

      2. 输入smbpasswd -a root 操作过程中输入的密码

      3. 本地通过网路,成功进入远程linux share的文件目录

      

    step3 vscode 打开本地的网络共享的文件目录root

      1. 网络文件夹驱动映射到本地

      

     2. vscode打开映射到本地的网络T文件夹,即实现了vscode直接连接远程的linux系统下共享的目录,再改代码,就能实时的联动起来。

    参考
    1. centos 安装smb :https://www.cnblogs.com/kevingrace/p/8550810.html

    2. ubuntu 安装smb: https://www.linuxidc.com/Linux/2018-11/155466.htm

    3. 网络映射到本地驱动设置 : https://jingyan.baidu.com/article/e3c78d646dfe8c3c4c85f5a9.html

  • 相关阅读:
    AppScan扫描教程
    iis发布网站可能遇到的问题及解决方法
    apache、nginx、iis日志记录的各个字段内容与含义
    nmap的使用教程
    ubuntu下编译wiringPi
    配置NAT
    华为OSPF与ACL综合应用实例讲解
    浮动静态路由及负载均衡
    静态路由及默认路由基本配置
    利用三层交换机实现VLAN间路由
  • 原文地址:https://www.cnblogs.com/syw-home/p/12526302.html
Copyright © 2011-2022 走看看