Execute actions before specific commands in Apache Guacamole - shell

I setup Apache Guacamole 0.9.14 on my CentOS 7 with nginx as reverse proxy to it.
I want to give limited access to some of my employees for some of my servers via ssh.
Some of them are SFTP enabled and to prevent sabotage on purpose or not I edit guacamole upload function to upload a copy of file uploaded on guacamole server itself alongside destination server.
I was wondering if I could create a copy of files getting on destination servers via wget, curl, etc.
If I can control specific commands on destination servers and do some actions before executing them, (For example backing files on guacamole server before executing any rm -rf command or creating a copy of file 'wget'ed on guacamole server), that would be great.
There are more than a thousand servers with different Linux OSs on them, so editing any server except guacamole server itself is impossible to do.
Any idea on how to control commands before executing on guacamole server specially on ssh?

Related

File uploading to Synology NAS Server fails in MAC OS

I currently purchased Synology's ds220+ model and am using it as a NAS Server.
The line is connected to the LAN port of the router to which the WAN line is plugged, and the end is connected to the NAS.
In this situation, I wanted to set up a NAS server to be used externally, not on a local network.
So I even set up WebDAV Server, DDNS, and port forwarding on the router.
To test this, I created a NAS server directory through RaiDrive in a Windows environment.
From the created directory, I tried to upload files to a folder with read/write permission and confirmed that it was working normally.
However, the problem occurred in MacOS.
In Finder, a server folder was created through the "Connect to Server" option, and a file upload was attempted, but an error such as the attached picture occurred in all types of files.
Could you tell me if there is a problem with the way MAC creates the server folder?
Idea: Your OS doesn't support SMB:
Download an FTP or SMB client. (FTP: E.g.: Filezilla)
Idea: A friewall is blocking it:
Check your anti-virus-program
Other Problem:
Use an USB Stick & NAS USB Copy
or upload it via DSM File Manager
Open NAS IP-adress via Safari/Firefox/Chrome
Log In
Open File Station / File Manager
Search folder
Click [Upload]
Choose the file from your PC
Finised

How to find out the port on which my PowerShell script is communicating to the other server?

I have a PowerShell script which copies certain files from a remote server and pastes in the local server. Now I need to use the file from another agent server which doesn't have connectivity to the remote server.
So I need to find out the port on which the communication will be established to the remote server from the agent server to copy the data.
I tried using netstat command but didn't find anything in that.
What are the steps to be followed to get the port information?

Laravel dependency installation on live server

I have uploaded a laravel site on live server and now I wanted to install a library like MailChimp. On local server I do it using composer but I want to do it on live server where the site is hosted and running . How to
install dependency and connect to hosting server using command line. Is it possible to access the hosting server file using DOS etc and run composer.
Well you can connect to the server through ssh and have access to the command line but it depends on the server, you might have the rights to install other programms or you may not...to get your hands on composer and install new dependencies you probably need to have those rights to install.
What type of server you have...VPS or Shared host. Probably on a VPS you can set up ssh connection...on a shared host things depend on what they have allowed you to have access to.

How to download a file from my server using SSH (using PuTTY on Windows)

When I try downloading a file from my server onto my computer, it actually downloads the file onto the server.
(Note I am already SSH'd into my server before typing this command. I've watched tutorials on YouTube and people are using their terminal without SSHing into any particular server, however I don't think I can do this with PuTTY on Windows?)
scp -r -P2222 kwazy#mywebsite.example:/home2/kwazy/www/utrecht-connected.nl ~/Desktop/
The problem is that I am specifying the location to download the file as only ~/Desktop/
This creates a folder called Desktop in my server, instead of copying the files onto my local desktop.
I am able to use this command on Linux.
I have successfully download the folder onto my desktop:
I still need insight onto how I can do this on a Windows machine.
There's no way to initiate a file transfer back to/from local Windows from a SSH session opened in PuTTY window.
Though PuTTY supports connection-sharing.
While you still need to run a compatible file transfer client (pscp or psftp), no new login is required, it automatically (if enabled) makes use of an existing PuTTY session.
To enable the sharing see:
Sharing an SSH connection between PuTTY tools.
Even without connection-sharing, you can still use the psftp or pscp from Windows command line.
See How to use PSCP to copy file from Unix machine to Windows machine ...?
Note that the scp is OpenSSH program. It's primarily *nix program, but you can run it via Windows Subsystem for Linux or get a Windows build from Win32-OpenSSH (it is already built-in in the recent versions of Windows 10 and in Windows 11).
If you really want to download the files to a local desktop, you have to specify a target path as %USERPROFILE%\Desktop (what typically resolves to a path like C:\Users\username\Desktop).
Alternative way is to use WinSCP, a GUI SFTP/SCP client. While you browse the remote site, you can anytime open SSH terminal to the same site using Open in PuTTY command.
See Opening Session in PuTTY.
With an additional setup, you can even make PuTTY automatically navigate to the same directory you are browsing with WinSCP.
See Opening PuTTY in the same directory.
(I'm the author of WinSCP)
try this scp -r -P2222 kwazy#mywebsite.example:/home2/kwazy/www/utrecht-connected.nl /Desktop
Another easier option if you're going to be pulling files left and right is to just use an SFTP client like WinSCP. Then you're not typing out 100 characters every time you want to pull something, just drag and drop.
Just noticed /Desktop probably isn't where you're looking to download the file to. Should be something like C:\Users\you\Desktop
OpenSSH has been added to Windows as of autumn 2018, and is included in Windows 10 and Windows Server 2019.
So you can use it in command prompt or power shell like bellow.
C:\Users\Parsa>scp parsa#192.168.100.11:/etc/cassandra/cassandra.yaml F:\Temporary
parsa#192.168.100.11's password:
cassandra.yaml 100% 66KB 71.3KB/s 00:00
C:\Users\Parsa>
(I know this question is pretty old now but this can be helpful for newcomers to this question)
if you install git with git bash, you get SCP available on windows.
You can use WinSCP : https://winscp.net/eng/download.php
Or MobaXterm : https://mobaxterm.mobatek.net/download.html
It feels like FTP client. Also I don't remember setting up anything on my machine for this. It just fresh install and install SSH server (IDK if it matters though).
For MobaXterm :
If your server have a http service you can compress your directory and download the compressed file.
Compress:
tar -zcvf archive-name.tar.gz -C directory-name .
Download throught your browser:
http://the-server-ip/archive-name.tar.gz
If you don't have direct access to the server ip, do a ssh tunnel throught putty, and forward the 80 port in some local port, and you can download the file.
You can use the WinSPC program. Its access to any server is pretty easy. The program gives its guide too. I hope it's helpfull.
If you need something with GUI you can use FileZilla. it support SFTP.
It's perfectly working with ssh and you can even edit files and it will automatically upload the changes.

CentOS 6.4 Minimal + how to configure jenkins jobs via xml?

I need to create a Build Server in CentOS 6.4 Minimal I sucessfully installed:
Java compiler (OpenJDK 1.7.0)
Git or Mercurial
Maven
Jenkins
Now I need to to the following:
At given intervals (eg daily at midnight) is the latest revision in the version control system (tip, HEAD, ...) compiled with Maven. In addition, Java Docs and packages (jar, war) need to be created.
Then Jenkins with all tests conducted and reported.
Make sure there is a report of previous builds
Ensure that the Java Docs and packages can be downloaded (jars, wars, ...) of the latest build
I can't use a GUI on CentOS Minimal so I need to configure the job in xml files? Could please someone show me the way... I'm not a linux server guru.
It's a bit impractical to configure Jenkins via XML by hand, because Jenkins' configuration is spread over multiple files, and the format of the configuration files changes between releases.
Given that Jenkins is a web application, you should be able to visit port 8080 (Jenkins' default port, assuming you didn't change it) on the server where you installed Jenkins (e.g. http://mycentosserver.example.com:8080), and configure it via the web interface.
If you're unable to access the web interface because of a firewall or similar, but you are able to SSH to the server (presumably you can, given that you were able to install stuff on it), you could set up an SSH tunnel to forward a port on your local machine to port 8080 on the server. For example, from your local machine, run the following command. You will then be able to access Jenkins on your local machine at http://localhost:28080 . If you're on Windows, you can use Putty to do the same thing.
ssh -L 28080:127.0.0.1:8080 mycentosserver.example.com
If you can't access the web app directly, and you can't SSH tunnel, I'd recommend setting up Jenkins on a server where you can access the web app, configuring it, and copying the XML config files from /var/lib/jenkins on that server across to your Centos server.

Resources