I would like to know what are the ways to automatically start daemons (sshd) in Fedora system. I know I can write a startup script that will put on /etc/init.d/.
What are the other options?
Somewhere I read that now in the new version of this can be done using the commands in the terminal, but I do not remember what it was.
EDIT: My 2 question.
I install ssh from source. When keys are generated for a server? During the installation?
You can do this via systemctl:
systemctl enable sshd.service
Related
Recently I decided to install Terraria server on Ubuntu Linux, but didn't find any completed instructions, so I decided to make my own, to help pure Terraria fans like me. This arcticle is relevant on 15.02.2019.
So first of all, you need a dedicated server. I used vps server from Heztner guys, but you can use any kind of tech you want (like raspberry pi or old pc with Ubuntu Server installed. Just make sure its minimal configuration fits Terraria Server).
After you first powered up your device and created password, we'll install SSH to make our setting up process a little bit comfy. You will be able to access server with any other device, if you have ssh installed in cmd or terminal.
Windows 10
Has SSH preinstalled in cmd. So all you need to do is
Type ssh-keygen (it will ask you to point the folder to extract keys, you can do it or just press enter)
Type ssh-copy-id "username"#"yourdeviceip" (Example: root#116.23.106.75)(In username type root)
Enter root password and you're in ')
Ubuntu 18.04
You may need to enable SSH in terminal. Use this instruction. Process is the same as in cmd on Windows 10.
Also
You can use SSH clients like Termius, you just need to create new Host with enabled SSH and put your server ip. Then choose user and enter password, and you're in.
Finally we're done with SSH and begining to setup our working environment. To fully operate with our system, we need to install several programs, as
mono-complete (to emulate windows shell environment, so TShock can work properly)
screen (to detach our terraria server screen)
unzip
And finally our Terraria server
Installation
First we create different user, so we store Terraria files separately of root.
adduser terraria
Then add it to sudo group, so you can launch several admin commands
adduser terraria sudo
Then install programs
sudo apt-get install mono-complete screen unzip
Enter as terraria user
su terraria
Go to your home folder
cd
Download latest TShock file, for me it's 4.3.25. If there is newer version, just go to their github page and copy zip file download link and paste it instead of mine.
sudo wget https://github.com/Pryaxis/TShock/releases/download/v4.3.25/tshock_4.3.25.zip
Unzip it
unzip tshock_4.3.25.zip
Delete zip-file
rm tshock_4.3.25.zip
Execute server one time to create the map
mono-sgen TerrariaServer.exe (type it every time you want to launch the server)
And now, when the map created and launched, you simply press ctrl+a to start screen, and then press d. Now your screen is detached and you can use your console regardless of server. Also this wont let your Terraria process shut down because of inactivity.
Bonus level
And this part will be for people who want to transfer their local map to server. I did it because first time I played Terraria with friends through Steam, and then I created server so map can run 24/7.
All you need to do is create ssh connection from device you store your local map. If you did it previously, then go to your Steam folder, find Terraria worlds, right click, properties and copy the path. Then go to cmd and type
scp "yourworldpath" terraria#*yourserverip*:~
It will copy your local world to home section, then go back to your ssh with terraria user and type
cd
mv "yourworldname" .local/share/Terraria/Worlds/
That thing will move your world file to hidden .local folder, where all world files store. Aaaand that's all. Just go to number 8 and do it again. Hope this guide will help you:) If you find any mistakes or face with problems, just comment this section, so I can fix it.
I have been looking out for ways to setup an automation environment and I found this application named Vagrant. I read the docs on the site, however I wanted to know from the experts out there if Vagrant with Oracle VirtualBox would suffice my needs.
I need to have a script that will call Vagrant to initialize a VM [The VM-Image is always the same - Windows Server 2008 R2]
I need to copy some of my project related files from a shared location onto the VM
Call a Batch file that will take care of test runs for me inside the VM
Once my test run is complete, This VM needs to be self destroyed/destructed.
Also, I would like to know if the Image be a custom .ISO file?
Sounds like Vagrant and VirtualBox will work for that scenario. Also, you might find that running commands in the VM using WinRM or SSH may be the easiest way to launch tests.
If you haven't already seen it, the blog post about Windows support in Vagrant 1.6 is informative: https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-windows.html
Creating a VirtualBox/Vagrant base VM from an .iso should work, and you can then do all of your work using the VM from that point onward.
To get started, you might try these steps:
Create a VirtualBox VM from your Windows .iso, using the VirtualBox GUI or cmdline tools.
Once you have the VM in the state you want it, shut it down and package it as a vagrant box - for example, on a Mac that step looks like (where Win7x64 is the dir containing the VirtualBox VM):
cd ~/VirtualBox\ VMs
vagrant package --base Win7x64 --output win7x64_base.box
Once that finishes, tell vagrant about the new base box:
vagrant box add win7x64_base /path/to/win7_base.box
Then you can vagrant init/vagrant up the VM:
mkdir win7 && cd win7
vagrant init win7x64
vagrant up
To enable SSH access, I installed Cygwin in the VM and configured sshd. So, after launching you can SSH in by running vagrant ssh
Note that if there's no Windows user in the VM named 'vagrant', you can specify the SSH username to use with vagrant ssh by placing this in your Vagrantfile:
config.ssh.username = 'user1'
As mentioned above, WinRM is also an option for remotely running commands.
And Vagrant apparently has some convenience features to make it easy to RDP into the VM, but I haven't looked at that.
So I want to run an .exe in SSH but can't figure out, help please?
I'm trying to run a server for my game i'm making and need this on my vps so anyone can connect, but can't figure out how to run it in SSH on my vps.
SSH is a protocol and will, by itself, never run any program. Depending on the Shell you're running inside SSH and the operating system in use you will start your executable:
Linux: ./program
Windows: program.exe
Note: exe usually indicates a Windows program. Most Linux/Unix servers have SSH access, while Microsoft servers usually don't. Are you trying to start a windows exe on a Linux machine? That will not work (ever). Unless it is a .NET executable, in which case you can start in using the mono-framework.
You need ./ before the program name, like this
./program.exe
You want to install an SSH server and make it run your own program instead of the default shell? How to configure that depends entirely on which product / package you are using; but perhaps rephrasing the problem for you is sufficient for helping you find the configuration directive you need in the documentation.
For windows, you can use the following command:
ssh username#remotePcIP "\file.exe"
Linux: This will run a series of commands remotely into a remote machine with ssh (make sure your username has direct access and password is not required):
ssh remotemachine ' command1 | command2 | command3 '
Is there an easy way to get xsp4 running as a background process on a linux server?
When I run xsp4 I get this:
xsp4
Listening on address: 0.0.0.0
Root directory: /test
Listening on port: 80 (non-secure)
Hit Return to stop the server.
So if I quit the terminal I am running it from it stops the server.
Do I have to write a daemon to do this? Or is there already something in place that I am missing?
Thanks
You have a couple of options. If your problem is terminal closing, then screen can be simple solution (just run screen xsp4, then Ctrl+A,D and you can close terminal). If the method you have used suits you, then use it -- however xsp will die after terminal closing. xsp should be generally used for debugging, production solutions are FastCGI or apache module, so these are daemons "by definition".
I had to use Mono for a demo that I had to show, and faced the same problem. My workaround was:
xsp4 --nonstop &
Note: It will show the initial information and if you hit enter, it will continue running. You can also exit the terminal if you want and it will continue as well.
you can do install the xsp4 in the terminal
sudo apt-get install mono-xsp4
then
go to your project Folder where the Asp project saved and type in the terminal
xsp4
I'm trying to get an Apache server running on my Cygwin setup to follow the Java Ranch Cattle Drive tutorials online (basically, to learn Java EE web page development that uses a MySQL back end.)
I used the Cygwin Setup program to install httpd (which is how I installed most other dev tools I use on cygwin) and it says install complete, yet when I run 'httpd' it cannot find the command. It also appears the expected install directory (/usr/local/apache...) doesn't exist.
Does anyone have any experience using this setup, and if so, you could walk me through the initial steps of getting the server up and running and getting a browser to display the server's default page?
To keep answers focused, I didn't want to discus the drawbacks of running Apache on a Windows system - this is just for learning purposes. Thanks in advance.
Looking at the Cygwin Package Listing for httpd, you can see that the executable is installed under /usr/sbin.
So, if /usr/sbin is not on your PATH (it isn't on mine, not by default anyhow), you would actually run:
/usr/sbin/httpd
And btw, if you would like to list the files installed for a certain package, you can use cygcheck:
cygcheck -l httpd
cygrunsrv -I Apache -p /usr/sbin/httpd -a "-X"
This will solve the problem. This assumes you already have cyrunsrv set up. The reason httpd fails with cygrunsrv if you leave out the -X is that the process disconnects from the terminal and cygrunsrv considers that a failure. The -X option for httpd is the debug or terminal mode.
I couldn't find any detailed information on how to get Apache working on Cygwin, so here it is if someone's interested:
Install the httpd-* and httpd-mod_* packages you need. Note that the packages named "Apache" are deprecated. You need the ones named "httpd" (which are actually Apache).
Install cygrunsrv (normally this is a default Cygwin package)
Run /usr/bin/cygserver-config as admin. This is needed because Apache requires an IPC server running.
Open services.msc, then go to the CYGWIN Cygserver. Right-click on it and start it. If you don't do this, you'll probably get errors like "AH00023: Couldn't create the proxy mutex".
Finally, start Apache by running /usr/sbin/apachectl restart
Config is in /etc/httpd/.
Some information about running Apache on Cygwin:
http://httpd.apache.org/docs/1.3/cygwin.html
http://www.issociate.de/board/goto/895433/apache2_does_not_start_in_cygwin.html
http://www.cygwin.com/ml/cygwin-apps/2005-02/msg00085.html
Personally, I would recommend installing WAMPServer or other WAMP stack and do it that way. There is no difference, except that you'll need to control Apache through Windows commands [net start, net stop], not Cygwin's ones.