如果您对真爱!Linux子系统登陆Windows服务器和linux子系统怎么用感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解真爱!Linux子系统登陆Windows服务器的各种细节,并对lin
如果您对真爱!Linux 子系统登陆 Windows 服务器和linux子系统怎么用感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解真爱!Linux 子系统登陆 Windows 服务器的各种细节,并对linux子系统怎么用进行深入的分析,此外还有关于go 实现 windows scp 文件到 linux 服务器、Linux on Windows with LinaLina,在 Windows 上使用 Linux、Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s、Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个的实用技巧。
本文目录一览:- 真爱!Linux 子系统登陆 Windows 服务器(linux子系统怎么用)
- go 实现 windows scp 文件到 linux 服务器
- Linux on Windows with LinaLina,在 Windows 上使用 Linux
- Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s
- Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个
真爱!Linux 子系统登陆 Windows 服务器(linux子系统怎么用)
Windows、Linux看似死敌一对,但其实微软对于开源实业还是相当支持的,Windows 10系统内就首次内置了一个Linux子系统(Windows Subsystem for Linux/WSL),允许开发者模拟Linux环境,而且有需要的可以直接从Windows应用商店下载SUSE、Ubuntu。
今天,微软又首次推出了用于Windows Server服务器系统的Linux子系统,并且已经向Windows Insider内测用户开放。
如果你安装了Build 16237或者更新预览版的Windows Server 2016,就可以打开这扇通往Linux的大门了,本质上就是个Linux虚拟机,可以执行一般任务,比如SSHD、MySQL等等,但不能持续运行Linux后台服务。
这也就意味着,你只能在Windows服务器里体验Linux,进行模拟开发,但不会得到一台Linux服务器。
哦对了,Windows 10上的Linux子系统最近已经脱离Beta测试阶段,完全成熟,微软也正在与更多Linux发行商合作,争取支持更多发行版。
等到九月份的Windows 10秋季创意者更新,所有用户就都能直接访问这个Linux子系统了。
稿源:快科技
go 实现 windows scp 文件到 linux 服务器
代码如下
package main
import (
"net"
"os"
"github.com/bramvdbogaerde/go-scp"
"golang.org/x/crypto/ssh"
)
func main() {
//clientConfig, _ := auth.PrivateKey("ubuntu", "", ssh.InsecureIgnoreHostKey())
clientConfig := &ssh.ClientConfig{
User: "ubuntu",
Auth: []ssh.AuthMethod{ssh.Password("PASSWORD")},
HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
return nil
},
}
client := scp.NewClient("IP:22", clientConfig)
f, _ := os.Open("C:\\a\\b.txt") //windows 文件路径
client.Connect()
defer client.Close()
defer f.Close()
client.CopyFile(f, "/home/ubuntu/", "0655")
}
Linux on Windows with LinaLina,在 Windows 上使用 Linux
Between WINE, VMware, BOCHs and virtual machines, we''re spoilt for choice when it comes to running Windows applications on Linux. But what about the other way around? Cygwin aside, there is another way.
在WINE、VMWARE 以及其它的一些虚拟机之间,我们可以任意选择一样来在LINUX系统下运行WINDOWS应用程序,但如果放过来呢?Cygwin 之外,我们又多了一条路。
![]() |
![]() |
Between WINE, VMware, BOCHs and ilk -- not to mention the renewed focus on virtualisation we''re now seeing -- we''re somewhat spoilt for choice when it comes to running Windows applications on Linux. But what about the other way around? Cygwin aside, there is another way.
It goes by the name of LINA, and after four years of development , it is due for release later next month. Building off a concept similar to Java, LINA aims to provide open-source developers the ability to compile applications that will run on all of Windows, MacOS X, and various Unix systems. Additionally, it promises to do so using each OS'' own interface libraries -- so a Linux application on Windows doesn''t look out of place -- and runs them within their own contained environment to ensure they don''t play up.
This is, of course, somewhat of a holy grail and raises all sorts of questions -- like just how easy is it to use, how does it perform, and what changes if any need to be made to Linux applications to run on the Lina platform.
While we won''t know until the next month when the product is released, we did fire off a bunch of questions to LINA developer Nile Geisinger, and got these answers:
How are Linux applications for LINA built?
Applications are recompiled using our versions of standard Linux libraries. Developers and maintainers can include a simple script to automatically build a LINA binary every time they make a release of their project.
What exactly is in a LINA executable?
Our Linux executables are bundled in zip files that contain configuration files and native executables for each platform.
What if you want to alter the ini files of an app, do you make changes directly to the files within the zip, or is it more complex than that?
Good question. The user can edit files that they normally would edit. For example, if they install Apache, they can modify their httpd.conf file in the same way they normally would.
What happens if applications depend on, for eg, a glibc library version that Lina doesn''t support?
In cases where an application depends upon a specific version of a library like glibc, they can statically link the libraries they need into their application without waiting for a new release of LINA.
Do you already have a repository of applications compiled for Lina ready to go, and if so which ones?
We do not have a repository, but we will have several demos that will be revealed upon release.
Is the ''secure and stable execution platform'' a function of the host OS or Lina? For eg -- permissions, is Lina enforcing access permissions or relying on those set by the OS?
Applications only have access to resources of the user''s operating system that LINA enables them to have access to. In addition to the OS enforcing permissions, LINA has been architected so that it can also enforce access permissions on an application by application basis. We plan on providing developers with tools that allow them to specify these permissions in the future.
Are OpenGL applications supported as well?
We are not supporting OpenGL in the short-term. Given the interest, though, we expect OpenGL support will emerge fairly quickly.
Speed -- how fast is it compared to a native application?
There is a 2X performance hit for running applications in LINA. In the short-term, there is also an additional performance hit for GUI applications. This additional performance hit will be eliminated when we optimize the mechanism by which we make operating system calls.
Lina is dual-licensed under the GPLv2 and a commercial license. What does the commercial license entail?
We are currently working out the details of the commercial license.
Finally, one other question -- where do you class LINA in the line between interpreters and bytecode, and virtualisation? It appears to be taking from each, so how would you describe it?
Nope, you''re right. LINA is borrowing from several existing categories that are normally quite separate from one another.
Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s
Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个
linux 和 Windows 互传文件
如何实现linux和Windows互传文件,在这里介绍一个插件,**lrzsz**
putty不支持
先使用 yum 按照一个插件 yum install -y lrzsz
[root@zhangzhen-01 ~]# yum install -y lrzsz
[root@zhangzhen-01 ~]# sz a.txt #r 表示远程注:sz 把 linux 上的文件传送到 Windows 上
[root@zhangzhen-01 ~]# rz (在哪个目录下就传到了哪个目录)
注:rz 把 Windows 上的文件传送到 linux 上
用户配置文件和密码配置文件
/etc/passwd 含义
/etc/passwd是由 “ :” 分割7个字段,每个字段的含义如下:
第1个字段为用户名;
第2个字段为该账号的口令,存储的是密码;
第3个字段为一个数字,这个数字代表用户标识号,也称为“uid”,在这里,用户标识号是从1000开始,如果我们创建一个普通用户,该账号的uid是从1000以后往下排序的;
第4个字段也是数字,该字段标识组标识号,称gid,这个字段对应着/etc/group中的一条记录,其实/etc/group和/etc/passwd相似;
第5个字段标识注释信息;
第6个字段为普通用户的家目录,root的家目录就是/root,普通用户的家目录则/home/username,用户的家目录也是可以修改的,在/etc/passwd配置文件中修改;
第7个字段为用户的shell,用户登录后,要启动一个进程们用来将用户下达的命令传给内核,实现一个交互的作用,这就是shell。
[root@zhangzhen-01 ~]# cat /etc/passwd #以下是创建了 3 个普通用户的信息
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
…………
zhangzhen-03:x:1000:1000::/home/zhangzhen-03:/bin/bash
user1:x:1001:1001::/home/user1:/bin/bash
zhang-02:x:1002:1002::/home/zhang-02:/bin/bash
/etc/shadow 含义,专门放用户的密码的配置文件
/etc/shadow 和 /etc/passwd 类似,由 9 个字段,示例如下:
我们看一下现在默认的配置:
[root@zhangzhen-01 ~]# head -n1 /etc/shadow ; tail -n3 /etc/shadow #head -n1 表示查看文件的第一行(在这里 root 的密码是用密文编写制成的,我们不可以反密文进行破解)。 “:” 分割,如果你想同时打两个命令的时候,用 “:” 进行分割。tail -n3 表示查看这个文件的最后三行。
root:$6$kN7rrKxW$9MRsf3mtd8CDdgZp25SCTdFp7ciymhS06FZe3z4oomxyxPrBMniWCktpqNlYmhmBGcWc8HSklX6b1ihRLKSfM1:17612:0:99999:7:::
zhangzhen-03:!!:17613:0:99999:7:::
user1:!!:17618:0:99999:7:::
zhang-02:!!:17619:0:99999:7:::
接下来我们给 user1 配置个密码:
[root@zhangzhen-01 ~]# passwd user1 #选择一个用户创建密码
passwd user1
更改用户 user1 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
接下来我们查看一下刚才的配置,user1 生成的密码也是以密文形式显示出来的:
[root@zhangzhen-01 ~]# head -n1 /etc/shadow ;tail -n3 /etc/shadow
root:$6$kN7rrKxW$9MRsf3mtd8CDdgZp25SCTdFp7ciymhS06FZe3z4oomxyxPrBMniWCktpqNlYmhmBGcWc8HSklX6b1ihRLKSfM1:17612:0:99999:7:::
zhangzhen-03:!!:17613:0:99999:7:::
user1:$6$gTcyr2nl$szsXaszsSj02hc1deEHB5sPYmENFOU1I1ydpB1H8Erjgv5Zf15zqP5P/k8CZfJH/2WtGuuI5dDCYbzAHLJctK0:17623:0:99999:7:::
zhang-02:!!:17619:0:99999:7:::
我们可以看一下 /etc/shadow 的使用说明:
[root@zhangzhen-01 ~]# man shadow
每个字段的含义是:
· sp_namp - 指向以 null 结束的用户名的指针
· sp_pwdp - 指向 null 结束的密码的指针
· sp_lstchg - 最近更改密码的日期(日期计算方法是从1970年1月1日开始的天数)
· sp_min - days before which password may not be changed
· sp_max - days after which password must be changed
· sp_warn - days before password is to expire that user is warned of pending password expiration
· sp_inact - days after password expires that account is considered inactive and disabled
· sp_expire - days since Jan 1, 1970 when account will be disabled
· sp_flag - reserved for future use
这里作为一个了解就好。
用户组管理
配置文件在 /etc/group, 我们可以用 cat /etc/group查看一下全部配置信息。
用户组密码配置文件在 /etc/gshadow下,在这里我们可以看见每个组的配置密码
命令格式:grouadd 后面跟想创建的组名,例:grouadd grp
创建制定Gid组格式:groupadd [-g GID] grp1,例:groupadd -g 1008 grp1
每一个配置文件下,都会有一个 “- 什么什么的文件”,这个是系统自动生成的备份,如下:
[root@zhangzhen-01 ~]# ls /etc/shadow #在这里我们可以看见,每一个配置文件后面系统会帮我们自动生成一个配置文件
shadow shadow-
[root@zhangzhen-01 ~]# ls /etc/gshadow
gshadow gshadow-
[root@zhangzhen-01 ~]# ls /etc/passwd
passwd passwd-
[root@zhangzhen-01 ~]# ls /etc/group
group group-
如何创建一个用户组(不指定 GID,系统默认从 1000 起开始创建)
[root@zhangzhen-01 ~]# groupadd grp1
[root@zhangzhen-01 ~]# tail -n1 /etc/group
grp1:x:1004:
如何创建一个用户组且制定 GID,测试 GID 为 1008.。
[root@zhangzhen-01 ~]# groupadd -g 1008 grp2
[root@zhangzhen-01 ~]# !tail
tail -n1 /etc/group
grp2:x:1008:
如何删除一个组? groudel 后面跟组名
[root@zhangzhen-01 ~]# tail -n5 /etc/group
user1:x:1001:
zhang-02:x:1002:
grp:x:1003:
grp1:x:1004:
grp2:x:1008:
[root@zhangzhen-01 ~]# groupdel grp
注:这里 groudel 是删除,如果组面有用户,则删除不了。
用户管理
命令介绍:
useradd 增加用户 格式 : useradd 后面跟想创建的用户名
还有一种给创建的用户,增加组名及家目录什么的;
格式如下:useradd [-u UID] [-g GID] [-d HOME] [-M] [-s] ,
-u 表示自定义UID
-g 表示使新增用户属于已经存在的某个组,后面可以跟组的id,也可以跟组名
-d 表示自定义目录的家目录
-M 表示不建立家目录
-s 表示自定义shell
下面先来新建一个用户 user5, 示例命令如下:(在这里,useradd 不加任何选项,直接跟用户名,可以创建一个跟用户名同名的组)
[root@zhangzhen-01 ~]# useradd user5
[root@zhangzhen-01 ~]# tail -n1 /etc/passwd
user5:x:1003:1003::/home/user5:/bin/bash
现在自定义一个 uid,gid 和所属组用户的示例:
[root@zhangzhen-01 ~]# useradd -u1006 -g 1008 -M -s /sbin/nologin user6 # -u1006 表示自定义的 UID 且没有的情况下,
-g 1008 表示自定义组且有的情况下,如果组没有的话,会提示报错,
-M 不创建用户的家目录,但是在 /etc/passwd 下可以看见这个字段,如果使用 ls /home/user6 查看的话,目录是不存在的。
这里 nologin 表示不可登录。
[root@zhangzhen-01 ~]# tail -n3 /etc/passwd
zhang-02:x:1002:1002::/home/zhang-02:/bin/bash
user5:x:1003:1003::/home/user5:/bin/bash
user6:x:1006:1008::/home/user6:/sbin/nologin
删除账户的命令 userdel
格式:userdel [-r] username
其中-r选项的作用是,当删除用户时,一并删除用户的家目录。
不删除家目录的同时去删除用户 test3,保留家目录:
[root@zhangzhen-01 ~]# ls /home/test3/
[root@zhangzhen-01 ~]# ls -ld /home/test3/
drwx------. 2 test3 grp3 62 4 月 3 00:25 /home/test3/
[root@zhangzhen-01 ~]# userdel test3
[root@zhangzhen-01 ~]# ls -ld /home/test3/
drwx------. 2 1011 grp3 62 4 月 3 00:25 /home/test3/注:只删除用户,并没有删除这个用户下的家目录。
我们再来试试删除 test2 试试,使用 - r 命令,并删除用户下的家目录
[root@zhangzhen-01 ~]# ls -ld /home/test2/
drwx------. 2 test2 test2 62 4 月 3 00:24 /home/test2/
[root@zhangzhen-01 ~]# userdel -r test2
[root@zhangzhen-01 ~]# !ls
ls -ld /home/test2/
ls: 无法访问 /home/test2/: 没有那个文件或目录注:在这里添加 - r 选项,删除用户并且删除用户下的家目录。
此时已经删除成功,test2 的家目录已经不存在了
关于真爱!Linux 子系统登陆 Windows 服务器和linux子系统怎么用的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于go 实现 windows scp 文件到 linux 服务器、Linux on Windows with LinaLina,在 Windows 上使用 Linux、Linux PHP53升级PHP5533 linux php升级5.5 php5.2 for linux linux libphp5.s、Linux 和 windows 互传文件,用户配置文件和密码配置文件,用户和用户组的管理 Linux 和 windows 互传文件我们会遇到需要把 pc 上的一个文件上传到 Linux 上,或者需要把 Linux 上的某一个的相关知识,请在本站寻找。
本文标签: