mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-06-22 04:51:29 +02: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 = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
permitRootLogin = "no"; # Disable root login
|
settings = {
|
||||||
passwordAuthentication = false; # Disable password login
|
X11Forwarding = true;
|
||||||
|
PermitRootLogin = "no"; # disable root login
|
||||||
|
PasswordAuthentication = false; # disable password login
|
||||||
|
};
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
forwardX11 = true; # Enable X11 forwarding
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Omit the rest of the configuration...
|
# Omit the rest of the configuration...
|
||||||
@ -68,4 +70,4 @@ To find configuration options and documentation:
|
|||||||
|
|
||||||
## References
|
## 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 后台服务
|
# 启用 OpenSSH 后台服务
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
permitRootLogin = "no"; # disable root login
|
settings = {
|
||||||
passwordAuthentication = false; # disable password login
|
X11Forwarding = true;
|
||||||
|
PermitRootLogin = "no"; # disable root login
|
||||||
|
PasswordAuthentication = false; # disable password login
|
||||||
|
};
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
forwardX11 = true; # enable X11 forwarding
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# 省略其他配置......
|
# 省略其他配置......
|
||||||
|
Loading…
x
Reference in New Issue
Block a user