Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dropbear compatible with mounted sdcard #1

Open
X-Ryl669 opened this issue Jul 19, 2019 · 0 comments
Open

Make dropbear compatible with mounted sdcard #1

X-Ryl669 opened this issue Jul 19, 2019 · 0 comments

Comments

@X-Ryl669
Copy link

Currently, in the code, there is:

#define SFTPSERVER_PATH "/usr/libexec/sftp-server"

/* This is used by the scp binary when used as a client binary. If you're
 * not using the Dropbear client, you'll need to change it */
#define DROPBEAR_PATH_SSH_PROGRAM "/usr/bin/dbclient"

Yet, the /usr path is mounted readonly on most install.
You can either replace by /opt (with is mounted from a R/W partition) or replace by a call to a new function:

char * get_path_for(const int v) {
    switch (v)
    {
    case 0: if (getenv("DROPBEAR_SSH_PATH")) 
                     return getenv("DROPBEAR_SSH_PATH");
                 return "/usr/bin/dbclient";
    case 1:  if (getenv("DROPBEAR_SFTP_PATH")) 
                     return getenv("DROPBEAR_SFTP_PATH");
                 return "/usr/libexec/sftp-server";
    default: return "";
    }
}

#define SFTPSERVER_PATH get_path_for(1)


/* This is used by the scp binary when used as a client binary. If you're
 * not using the Dropbear client, you'll need to change it */
#define DROPBEAR_PATH_SSH_PROGRAM get_path_for(0)

That way, the path to look for depend on the environnement that can be updated depending if the rootfs is on the sdcard or in /system/sdcard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant