Samba wake server from sleep?

I have a shared folder set up between my Linux computer and my Windows Computer using samba. Right now if my Linux computer goes into standby mode or sleep mode I cannot wake the computer up by connecting from my Windows computer. Is there a way to accomplish this? Either not allow Linux to sleep if the windows PC is connected, or(preferably) to wake up the Linux PC when the Windows computer connects.

Running Windows 10 Running Debian 10 Samba - Version 4.9.5-Debian


Solution 1:

Samba is not the right tool to wake up a sleeping computer. You should rather use Wake-on-LAN:

Wake-on-LAN (WoL) is an Ethernet or Token Ring computer networking standard that allows a computer to be turned on or awakened by a network message.

The message is usually sent to the target computer by a program executed on a device connected to the same local area network. It is also possible to initiate the message from another network by using subnet directed broadcasts or a WoL gateway service.

You will find detailed instructions for Debian in the article WakeOnLan. The process deals mostly with software, although some minimal hardware support is required (shouldn't be a problem unless for an old computer).