mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-01-16 10:58:50 +01:00
fix: openssh config in nixos 23.05
This commit is contained in:
parent
d6cce1383e
commit
abe0a20ddb
@ -40,13 +40,15 @@ To illustrate how to use `/etc/nixos/configuration.nix`, let's consider an examp
|
||||
];
|
||||
};
|
||||
|
||||
# Enable openssh-server
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
permitRootLogin = "no"; # Disable root login
|
||||
passwordAuthentication = false; # Disable password login
|
||||
settings = {
|
||||
X11Forwarding = true;
|
||||
PermitRootLogin = "no"; # disable root login
|
||||
PasswordAuthentication = false; # disable password login
|
||||
};
|
||||
openFirewall = true;
|
||||
forwardX11 = true; # Enable X11 forwarding
|
||||
};
|
||||
|
||||
# Omit the rest of the configuration...
|
||||
@ -68,4 +70,4 @@ To find configuration options and documentation:
|
||||
|
||||
## References
|
||||
|
||||
- [Overview of the NixOS Linux distribution](https://nixos.wiki/wiki/Overview_of_the_NixOS_Linux_distribution)
|
||||
- [Overview of the NixOS Linux distribution](https://nixos.wiki/wiki/Overview_of_the_NixOS_Linux_distribution)
|
||||
|
@ -51,10 +51,12 @@ NixOS 的系统配置路径为 `/etc/nixos/configuration.nix`,它包含系统
|
||||
# 启用 OpenSSH 后台服务
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
permitRootLogin = "no"; # disable root login
|
||||
passwordAuthentication = false; # disable password login
|
||||
settings = {
|
||||
X11Forwarding = true;
|
||||
PermitRootLogin = "no"; # disable root login
|
||||
PasswordAuthentication = false; # disable password login
|
||||
};
|
||||
openFirewall = true;
|
||||
forwardX11 = true; # enable X11 forwarding
|
||||
};
|
||||
|
||||
# 省略其他配置......
|
||||
|
Loading…
Reference in New Issue
Block a user