You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04中signify使用方法及远程桌面连接脚本变量问题

Hey there! Let's tackle your two Ubuntu-related questions one by one:

1. Using the signify tool on Ubuntu 16.04

Ubuntu 16.04 doesn't include signify in its default repositories, so we'll need to install it first. Here are two reliable methods:

Method 1: Install via PPA (if available)

Some third-party PPAs host signify for older Ubuntu versions. Try this:

sudo add-apt-repository ppa:martin-frost/thoughtbot-rcm
sudo apt-get update
sudo apt-get install signify

If the PPA doesn't work for 16.04, go with the source compilation method below.

Method 2: Compile from source

This is a surefire way to get signify working:

# Install build dependencies
sudo apt-get install build-essential git
# Clone the signify repo
git clone https://github.com/aperezdc/signify.git
cd signify
# Compile and install
make
sudo make install

Basic signify Usage

Once installed, here's how to use it for common tasks:

  • Generate a key pair:
    signify -G -p public.key -s secret.key
    
    You'll be prompted to set a passphrase to protect your private key.
  • Sign a file:
    signify -S -s secret.key -m your-file.txt
    
    This creates your-file.txt.sig, the signature file for your document.
  • Verify a file's signature:
    signify -V -p public.key -m your-file.txt
    
    If the signature is valid, you'll see "Signature Verified"; if not, you'll get an error message.
2. Shell Script for Remote Desktop Between Ubuntu Systems

To create a script that handles both trusted (encrypted) and untrusted remote desktop connections, we'll use VNC with SSH tunneling for trusted connections, and direct VNC for untrusted. We'll also integrate your user input logic into the script.

Prerequisite: Set Up VNC Server on the Target System

First, install and configure a VNC server on the Ubuntu machine you want to connect to:

sudo apt-get install tightvncserver
# Run this once to set a VNC password
tightvncserver :1

This starts the VNC server on display :1 (port 5901).

Update Your myscript.sh Script

Replace your existing script with this version, which handles input and both connection types:

#!/bin/bash

# Get user input
read -p "Enter target Ubuntu system IP address: " target_ip
read -p "Enter target system username: " target_user
read -s -p "Enter target system password: " target_pass
echo "" # Add a newline after password input

# Untrusted Connection (Direct VNC, no encryption)
echo "Establishing untrusted remote desktop connection..."
# Use expect to auto-enter VNC password
expect << EOF
spawn vncviewer $target_ip:1
expect "Password:"
send "$target_pass\r"
interact
EOF

# Trusted Connection (Encrypted via SSH Tunnel)
echo -e "\nEstablishing trusted remote desktop connection..."
# Create SSH tunnel first, then launch VNC viewer
expect << EOF
spawn ssh -L 5901:localhost:5901 $target_user@$target_ip
expect "password:"
send "$target_pass\r"
# Wait a moment for tunnel to establish, then launch VNC
sleep 2
spawn vncviewer localhost:1
expect "Password:"
send "$target_pass\r"
interact
EOF

Script Setup & Notes

  1. Install expect: The script uses expect to handle interactive password prompts, so install it first:
    sudo apt-get install expect
    
  2. Make the script executable:
    chmod +x myscript.sh
    
  3. Run the script:
    ./myscript.sh
    

Alternative: Using RDP with xfreerdp

If you prefer using RDP instead of VNC, you can modify the script to use xfreerdp:

# Untrusted RDP connection
xfreerdp /u:$target_user /p:$target_pass /v:$target_ip
# Trusted RDP connection via SSH tunnel
ssh -L 3389:localhost:3389 $target_user@$target_ip
xfreerdp /u:$target_user /p:$target_pass /v:localhost

内容的提问来源于stack exchange,提问作者Viral Nakrani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 07:31:51