Few questions about unmanaged linux

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
Jake
A regular
A regular
Posts: 52
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed May 28, 2014 9:20 pm

Few questions about unmanaged linux

Post by Jake »

Firstly, I am very new to using linux, so I wanted to rent this as a learning opportunity for me.

Every time I use the sudo command, the follow error immediately follows it, annoying, but I suppose it doesn't effect anything.

Code: Select all

sudo: unable to resolve host sleek
Secondly, I am getting permission errors when trying to run an application that is within my home directory. I created a user named minecraft, then placed a folder inside the home folder named minecraft and stuck the jar in there, every time I attempt to run the server, it throws a bunch of errors about insufficient permission. If I run it under root, it runs perfectly. I even installed and 'wgot' all the files through the user, not through root, which I would think would make it so I owned the files.

Additionally to this, how do I switch between terminal sessions? I have setup a teamspeak server perfectly on it, that starts when the computer starts via /etc/rc.local but how would I go in to access it? Once I successfully setup my minecraft server, how do I change sessions to view and use the console?
$atanic $pirit
This is my homepage
This is my homepage
Posts: 251
Joined: Tue Jan 28, 2014 5:32 am

Re: Few questions about unmanaged linux

Post by $atanic $pirit »

First of all whenever you ask help for issues regarding linux then, please don't forget to mention the distro. Different distros have different ways of working and doing things, so knowing that makes it a bit easier to provide support.

If you are having issues with file permission then you can try chown command. What I would recommend is that you use this command from root user.

Code: Select all

chown username:usergroup /folder
If I run it under root, it runs perfectly. I even installed and 'wgot' all the files through the user, not through root, which I would think would make it so I owned the files.
It seems like the folder in which you are trying to add files is owned by root. Hence, anything you put in there automatically gets owned by root. Once again we would be able to better assist you, if we would be able to better assist you if we knew distro name.
Additionally to this, how do I switch between terminal sessions? I have setup a teamspeak server perfectly on it, that starts when the computer starts via /etc/rc.local but how would I go in to access it? Once I successfully setup my minecraft server, how do I change sessions to view and use the console?
Your TeamSpeak server would be handled by the admin token. As for running 2 terminals at the same time, you can use a linux app called screens. It will run programs in the back and you can give them a name, so you use screen -r name to bring that particular program in the front.
Image
Jake
A regular
A regular
Posts: 52
Joined: Wed May 28, 2014 9:20 pm

Re: Few questions about unmanaged linux

Post by Jake »

How does root own my folder when it's my home folder. Also, the distro is ubuntu 14.04.

I've tried chown and chmod a few different times, but in this specific scenario I haven't yet, so I'll give that a shot.

I installed screens last night because I thought surely there was some way to change sessions natively, but I guess I was wrong. I'm also unsure what usergroup I'm in to use in the chown command, which could be why my previous attempts have failed. What would the default user group be? Do I need to assign it one?

Here is a portion of my /etc/rc.local

Code: Select all

sleep 2
su teamspeak -c 'screen -d -m -S ts3 /home/teamspeak/teamspeak/ts3server_minimal_runscript.sh inifile=ts3server.ini'
su minecraft -c 'screen -d -m -S mc java -Xms128M -Xmx1792M -jar /home/minecraft/minecraft/craftbukkit-beta.jar nogui'
If I type screen -r ts3 into root, it replies with this:

Code: Select all

There is no screen to be resumed matching ts3.
User avatar
soja
This is my homepage
This is my homepage
Posts: 2389
Joined: Fri May 18, 2012 3:20 pm

Re: Few questions about unmanaged linux

Post by soja »

the hostname you entered when ordering is now the operating systems hostname. You don't have a dns entry that resolves "sleek" to your VDS's IP. If you type this as root:

Code: Select all

hostname my.ip.add.ress
this should be fixed, but if you have a domain just made an "A" record(perhaps sleek.mycommunity.com) and then type in the OS as root

Code: Select all

hostname sleek.mycommunity.com
Satanic hit it on the head, most likely when making your home directory you created it under the root user and forgot to change ownership to your new user. You can check this using:

Code: Select all

ls -al
Your output will look like this:
Image

as you can see, my folders names nfo and ts3 are owned by the ts3 user:group, and my backups folder is owned by the backups user:group.
Not a NFO employee
Jake
A regular
A regular
Posts: 52
Joined: Wed May 28, 2014 9:20 pm

Re: Few questions about unmanaged linux

Post by Jake »

Alright, that seemed to solve all my problems with host name and permissions, but the one problem remains: How to switch between screen sessions that were created in /etc/rc.local. Again this is an ubuntu 14.04 server.

Here is the section of my rc.local that starts my ts3 and minecraft servers:

Code: Select all

su teamspeak -c 'screen -d -m -S ts3 /home/teamspeak/teamspeak/ts3server_minimal_runscript.sh inifile=ts3server.ini'
cd /home/minecraft/minecraft
su minecraft -c 'screen -d -m -S mc java -Xms128M -Xmx1792M -jar craftbukkit-beta.jar nogui'
When I launch a putty session, and type screen -r mc it says There are no screens to be resumed matching mc. Hell, if I type screen -ls it says No Sockets found in /var/run/screen/S-root.

I am now confused as to how both these servers are running, and how I can access their consoles.
User avatar
soja
This is my homepage
This is my homepage
Posts: 2389
Joined: Fri May 18, 2012 3:20 pm

Re: Few questions about unmanaged linux

Post by soja »

Running just screen -r will list all screens that you can attach to. Are you trying to attach to the screens as root, or as another user? Have you tried attaching as root?
Not a NFO employee
$atanic $pirit
This is my homepage
This is my homepage
Posts: 251
Joined: Tue Jan 28, 2014 5:32 am

Re: Few questions about unmanaged linux

Post by $atanic $pirit »

Let me elaborate on the screens concept.

You won't get any screens with screen -r command, unless you start a program with screens. You have to start your application with screen command for it to work in background and come upfront upon call. So, instead of using ./start_script you will use

Here is the syntax of how to do it.

Code: Select all

screen -A -m -d -S minecraft ./start_script
you can give it any name you want. I just used minecraft just to illustrate.

Once you start the server like that, it will run in the background and you can close putty. The benefit of screen is that you can close your terminal, but your server will still be running in the background. As stated previously, all you gotta do is use this command to bring it upfront.

Code: Select all

screen -r minecraft
Remember, you only need to mention name when you are running multiple screen apps. Otherwise screen -r would be enough for you.


This is the list of all screen parameters, if you wanna learn more about them.

Code: Select all

-a Force all capabilities into each window's termcap.
-A -[r|R] Adapt all windows to the new display width & height.
-c file Read configuration file instead of '.screenrc'.
-d (-r) Detach the elsewhere running screen (and reattach here).
-dmS name Start as daemon: Screen session in detached mode.
-D (-r) Detach and logout remote (and reattach here).
-D -RR Do whatever is needed to get a screen session.
-e xy Change command characters.
-f Flow control on, -fn = off, -fa = auto.
-h lines Set the size of the scrollback history buffer.
-i Interrupt output sooner when flow control is on.
-l Login mode on (update /var/run/utmp), -ln = off.
-list or -ls. Do nothing, just list our SockDir.
-L Terminal's last character can be safely updated.
-m ignore $STY variable, do create a new screen session.
-O Choose optimal output rather than exact vt100 emulation.
-p window Preselect the named window if it exists.
-q Quiet startup. Exits with non-zero return code if unsuccessful.
-r Reattach to a detached screen process.
-R Reattach if possible, otherwise start a new session.
-s shell Shell to execute rather than $SHELL.
-S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
-t title Set title. (window's name).
-T term Use term as $TERM for windows, rather than "screen".
-U Tell screen to use UTF-8 encoding.
-v Print "Screen version 3.09.13 (FAU) 5-Sep-02".
-wipe Do nothing, just clean up SockDir.
-x Attach to a not detached screen. (Multi display mode).
-X Execute <cmd> as a screen command in the specified session.
Moving onto your second issue which would be TS3 server. TS3 server runs as a service instead of an program, so I doubt you would be able to use screen for that. I never ran TS3 server, but if I remember the basics of TS3 then everything is controlled by admin token. You won't even need to do much from terminal, but again I have a very limited knowledge about TS3 servers, so I could be wrong.
Jake wrote: Here is a portion of my /etc/rc.local

Code: Select all

sleep 2
su teamspeak -c 'screen -d -m -S ts3 /home/teamspeak/teamspeak/ts3server_minimal_runscript.sh inifile=ts3server.ini'
su minecraft -c 'screen -d -m -S mc java -Xms128M -Xmx1792M -jar /home/minecraft/minecraft/craftbukkit-beta.jar nogui'
If I type screen -r ts3 into root, it replies with this:

Code: Select all

There is no screen to be resumed matching ts3.
You don't need the rc.local thing when you are using screen. Just use screen and run your apps, it works pretty well.
Image
Jake
A regular
A regular
Posts: 52
Joined: Wed May 28, 2014 9:20 pm

Re: Few questions about unmanaged linux

Post by Jake »

Yes, but assuming the server is crashed/restarted, I want my applications to automatically load themselves without me having to access the console, which is why I used rc.local.
$atanic $pirit
This is my homepage
This is my homepage
Posts: 251
Joined: Tue Jan 28, 2014 5:32 am

Re: Few questions about unmanaged linux

Post by $atanic $pirit »

Does minecraft come with an auto-restart script? I know SRCDS does. Another alternative would be to use crontabs.
Image
joshh20
This is my homepage
This is my homepage
Posts: 146
Joined: Sat Mar 02, 2013 1:35 pm

Re: Few questions about unmanaged linux

Post by joshh20 »

Minecraft by default doesn't have an automatic restart script, but if you used Spigot, you can set a script to automatically be executed if a crash is detected.
Post Reply